Jump to content

[SA] Morphing in-game


Shmoopy

Recommended Posts

How to morph a mesh in-game


- Tools needed:

- Step 1:
Import your model , I chose to import the Admiral model , select the part you want to modify if your model has multiple parts , I chose the chassis, [Right-click] on it and click on [Hide unselected] , then expand the + Editable mesh and go to - Vertex mode and select the vertices which you want to apply your modification on:


46ec5d27_o.png


Run the script that you downloaded:


B1.JPG


Click on export , make sure that the vertices are still selected :


d8c7daec_o.png


- Step 2:

You should obtain the vertices ids like shown below :


b0ae24cf_o.png



Make a new ini file out of it like this :


3113e87c_o.png


Save your ini file to the cleo folder

- Step 3:
Use this script to manipulate your vertices :






const  chassis = 0x64C              wheel_rf_dummy = 0x650             wheel_rm_dummy = 0x654             wheel_rb_dummy = 0x658             wheel_lf_dummy = 0x65C             wheel_lm_dummy = 0x660             wheel_lb_dummy = 0x664            door_rf_dummy = 0x668             door_rr_dummy = 0x66C              door_lf_dummy = 0x670             door_lr_dummy = 0x674             bump_front_dummy = 0x678           bump_rear_dummy = 0x67C           wing_rf_dummy = 0x680                wing_lf_dummy = 0x684                bonnet_dummy = 0x688              boot_dummy = 0x68C                windscreen_dummy = 0x690           exhaust_ok = 0x694                misc_a = 0x698                    misc_b = 0x69C                    misc_c = 0x6A0                     misc_d = 0x6A4                    misc_e = 0x6A8 end0AB1: call_scm_func @VehNodeGetStructure params 2 car 1@ node chassis ret: RwFrame 2@ RpAtomic 3@ RpClump 4@ RpGeometry 5@ RpMaterial 6@ 7@ = 1 // Beginning IDrepeatwait 00AD3: 8@v = format "%d" 7@0AF0: 10@ = get_int_from_ini_file "cleo\data.ini" section "chas_top" key 8@v0AB1: call_scm_func @MorphGeometryPoints params 6 RpGeometry 5@ starting_V3d_ID 10@ num_Points 1 morph 0.0 0.0 0.4 7@ += 1until 7@ == 185 // Ending ID + 1end_thread:MorphGeometryPoints   0AA7: RwMatrixCreate 0x7F2A50 num_params 0 pop 0 RwMatrix 7@//0AA5: RwMatrixScale 0x7F22C0 num_params 3 pop 3 combine 1 scaleoffset 3@v RwMatrix 7@//0AA5: RwMatrixRotate 0x7F1FD0 num_params 4 pop 4 combine 1 rot_angle 90.0 rot_axis 3@v RwMatrix 7@0AA5: RwMatrixTranslate 0x7F2450 num_params 3 pop 3 combine 1 pos 3@v RwMatrix 7@0@ += 920A8D: 11@ = read_memory 0@ size 4 virtual_protect 0 //RpMorphTargets0@ -= 9211@ += 28 // RwV3d 1 - RwV3d in 1@ -= 114@ = 12006A: 14@ *= 1@  005A: 11@ += 14@   0085: 12@ = 11@ // RwV3d out 0AA5: RpGeometryLock 0x74C7D0 num_params 2 pop 2 Lockmode 0x02 RpGeometry 0@ //rpGEOMETRYLOCKPOLYGONS = 0x01 ;rpGEOMETRYLOCKVERTICES = 0x02 ;rpGEOMETRYLOCKNORMALS = 0x04 ;rpGEOMETRYLOCKPRELIGHT = 0x08 ;rpGEOMETRYLOCKTEXCOORDS = 0x10 ;rpGEOMETRYLOCKTEXCOORDS1 = 0x10 ;rpGEOMETRYLOCKTEXCOORDS2 = 0x20 ;rpGEOMETRYLOCKTEXCOORDS3 = 0x40 ;rpGEOMETRYLOCKTEXCOORDS4 = 0x80 ;rpGEOMETRYLOCKTEXCOORDS5 = 0x0100 ;rpGEOMETRYLOCKTEXCOORDS6 = 0x0200 ;rpGEOMETRYLOCKTEXCOORDS7 = 0x0400 ;rpGEOMETRYLOCKTEXCOORDS8 = 0x0800 ;rpGEOMETRYLOCKTEXCOORDSALL = 0x0ff0 ;rpGEOMETRYLOCKALL = 0x0fff 0AA5: RwV3dTransformPoints 0x7EDD90 num_params 4 pop 4 RwMatrix 7@ numPoints 2@ V3d_pointsIn 11@ V3d_pointsOut 12@0AA5: RpGeometryUnlock 0x74C800 num_params 1 pop 1 RpGeometry 0@ 0AB2: ret 0:VehNodeGetStructure 0A97: 12@ = car 0@ struct005A: 12@ += 1@  0A8D: 12@ = read_memory 12@ size 4 virtual_protect 00AB1: call_scm_func @FrameGetAtomic 1 RwFrame 12@ ret: RpAtomic 5@0AB1: call_scm_func @AtomicGetClump 1 RpAtomic 5@ ret: RpClump 6@0AB1: call_scm_func @AtomicGetGeometry 1 RpAtomic 5@ ret: RpGeometry 7@0AB1: call_scm_func @GeometryGetMaterial 1 RpGeometry 7@ ret: RpMaterial 8@0AB2: ret 5 12@ 5@ 6@ 7@ 8@:GeometryGetMaterial0AA7: call 0x74c760 num_params 2 pop 2 RpTriangle 0@ RpGeometry 0@ RpMaterial 1@ 0AB2: ret 1 1@:AtomicGetGeometry0@ += 0x180A8D: 0@ = read_memory 0@ size 4 virtual_protect 00AB2: ret 1 0@:AtomicGetClump0@ += 0x3C0A8D: 0@ = read_memory 0@ size 4 virtual_protect 00AB2: ret 1 0@:FrameGetAtomic0AA7: call_function 0x7348C0 num_params 1 pop 1 RwFrame 0@ RpAtomic 1@ 0AB2: ret 1 1@:FrameGetChild0@ += 0x980A8D: 0@ = read_memory 0@ size 4 virtual_protect 00AB2: ret 1 0@:FrameGetNext0@ += 0x9C0A8D: 0@ = read_memory 0@ size 4 virtual_protect 00AB2: ret 1 0@:FrameGetRoot0@ += 0xA00A8D: 0@ = read_memory 0@ size 4 virtual_protect 00AB2: ret 1 0@



- Results:

1e8425ef_o.png
905f00d9_o.png

You can modify any part you want:

b6f6cceb_o.png
c1e5473f_o.png

Edited by Shmoopy
Link to comment
Share on other sites

look to RpMorph plugin in rwsdk.

Also, learn how to work with file read/write operations. Don't use INI for such tasks.

Edited by DK22Pac
Link to comment
Share on other sites

look to RpMorph plugin in rwsdk.

Also, learn how to work with file read/write operations. Don't use INI for such tasks.

 

RpMorph is definitely implemented in Gta SA ...

Oh , and I prefer to work with a 3 lines code for reading data rather than a sh*thole of 0A9D: readfile 0@ size 1 to 2@

Edited by Shmoopy
Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.