You all might not know that this Opcodes actually has a problem modifying the three rotations
Code:
0175: set_car 22@ Z_angle_to 315.0 // sets Z-angle to 315.0.... BUT ALSO SETS X-ANGLE AND Y-ANGLE TO 0.0
0731: set_car 34@ y_angle_to 73@ // sets Y-angle to 73@.... BUT ALSO SETS X-ANGLE AND Z-ANGLE TO 0.0

That is why I advise those who are dealing with changing the Car Rotations to use this snippet. This Snippet sets the Car Rotations in XYZ, the original source was posted by woksonal at blast.hk website. But I improved it to becoming more flexible when changing specific plane angle:
Code:
// Format:
// call @SetCarAngles 4 {CarHandle} 0@ {angleX} 1@ {angleY} 2@ {angleZ} 3@
// Usage:
// call @SetCarAngles 4 {CarHandle} 15@ {angleX} -1 {angleY} -1 {angleZ} 13@ // set car 15@ z angle to 13@ while maintaining both x and y angles
// call @SetCarAngles 4 {CarHandle} 22@ {angleX} -1 {angleY} 18@ {angleZ} -1 // set car 22@ y angle to 18@ while maintaining both x and z angles
// call @SetCarAngles 4 {CarHandle} 1@ {angleX} 27@ {angleY} -1 {angleZ} -1 // set car 1@ x angle to 27@ while maintaining both y and z angles
// call @SetCarAngles 4 {CarHandle} 30@ {angleX} 27@ {angleY} 16@ {angleZ} -1 // set car 30@ x angle to 27@ , y angle to 27@ while maintaing z angle
// call @SetCarAngles 4 {CarHandle} 30@ {angleX} 27@ {angleY} 16@ {angleZ} 13@ // set car 30@ x angle to 27@ , y angle to 27@ , z angle to 13@
:SetCarAngles // original snippet by woksonal from blast.hk , modified by aldrinjohnom
0A97: 4@ = car 0@ struct
4@ += 0x14
0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0 // car matrix rotations
4@ += 48
0A8D: 5@ = read_memory 4@ size 4 virtual_protect 0 // get car x-axis position
4@ += 4
0A8D: 6@ = read_memory 4@ size 4 virtual_protect 0 // get car y-axis position
4@ += 4
0A8D: 7@ = read_memory 4@ size 4 virtual_protect 0 // get car z-axis position
4@ -= 56

if 1@ == -1
then 077D: 1@ = car 0@ x_angle
end
1@ *= 0.01745329251994329576923690768489 // X degrees to radians

if 2@ == -1
then 06BE: 2@ = car 0@ y_angle
end
2@ *= 0.01745329251994329576923690768489 // Y degrees to radians

if 3@ == -1
then 0174: 3@ = car 0@ Z_angle
end
3@ *= 0.01745329251994329576923690768489 // Z degrees to radians

0AA6: call_method 0x59B120 struct 4@ num_params 3 pop 0 3@ 2@ 1@  // set ZYX rad respect to origin(0.0 0.0 0.0)

4@ += 48
0A8C: write_memory 4@ size 4 value 5@ virtual_protect 0 // set car x-axis position
4@ += 4
0A8C: write_memory 4@ size 4 value 6@ virtual_protect 0 // set car y-axis position
4@ += 4                                                   
0A8C: write_memory 4@ size 4 value 7@ virtual_protect 0 // set car z-axis position
ret 0
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Update: this is an outdated snippet and rotates inaccurately. Change Vehicle rotations using Quaternion instead:
PHP:
:SetVehicleRotationAngles // 0AB1: @SetVehicleRotationAngles 4 _Vehicle 0@ _Pitch_X 1@ _Roll_Y 2@ _Yaw_Z 3@
0AB1: @AnglesToQuaternion 3 _Pitch_X 1@ _Roll_Y 2@ _Yaw_Z 3@ _ReturnQuaternion: _X 31@ _Y 30@ _Z 29@ _W 28@
07C6: set_car 0@ quaternion_xyzw_to 31@ 30@ 29@ 28@
0AB2: ret 0
Requires AnglesToQuaternion SubSnippet.
 
Top