Computes the Vehicle's XYZ Rotation Velocity relative to its own X(Pitch), Y(Roll), and Z(Yaw) Axes.
Computes the Vehicle's XYZ Rotation Velocity Relative to its own z(Roll) Axis. The Computation uses a Relative x(Pitch) Axis and Y(Roll) Axes pinned at 0.0 degrees.
Computes the Vehicle's XYZ Rotation Velocity relative to the TrueNorth's Axis by NS, EW, and NW.
Code:
:GetVehicleRelativeRotationVelocityPerFrame // 0AB1: @GetVehicleRelativeRotationVelocityPerFrame 1 _OfVehicleHandle 0@ _StoreRotationVelocityXYZ 29@ 30@ 31@
00AA: store_car 0@ position_to 29@ 30@ 31@
0A97: 27@ = vehicle 0@ struct
27@ += 80 // X (NS) Spin
0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0
005B: 29@ += 26@ // X Origin to our Vehicle Position
27@ += 4 // Y (EW) Spin
0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0
005B: 30@ += 26@ // Y Origin to our Vehicle Position
27@ += 4 // Z (NW) Spin
0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0
005B: 31@ += 26@ // Z Origin to our Vehicle Position
27@ -= 88
0AB1: @worldCoordsToEntityOffsets 4 _entity 27@ _coords_XYZ 29@ 30@ 31@ _store_to 29@ 30@ 31@
ret 3 29@ 30@ 31@
Code:
:GetVehicleRelativeRotationVelocityPerSecond // 0AB1: @GetVehicleRelativeRotationVelocityPerSecond 1 _OfVehicleHandle 0@ _StoreRotationVelocityXYZ 29@ 30@ 31@
00AA: store_car 0@ position_to 29@ 30@ 31@
// Per Frame to Per Second Converter
0A8D: 28@ = readMem 0xB7CB5C size 4 vp 0 // gta frame time, use in order to be consistent with FPS
if 28@ == 0.0
then 28@ = 1.0
else 28@ /= 50.0
end
//
0A97: 27@ = vehicle 0@ struct
27@ += 80 // X (NS) Spin
0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0
0073: 26@ /= 28@ // normalize RV to Per Second
005B: 29@ += 26@ // X Origin to our Vehicle Position
27@ += 4 // Y (EW) Spin
0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0
0073: 26@ /= 28@ // normalize RV to Per Second
005B: 30@ += 26@ // Y Origin to our Vehicle Position
27@ += 4 // Z (NW) Spin
0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0
0073: 26@ /= 28@ // normalize RV to Per Second
005B: 31@ += 26@ // Z Origin to our Vehicle Position
27@ -= 88
0AB1: @worldCoordsToEntityOffsets 4 _entity 27@ _coords_XYZ 29@ 30@ 31@ _store_to 29@ 30@ 31@
ret 3 29@ 30@ 31@
Code:
:SetVehicleRelativeRotationVelocityPerFrame // 0AB1: @SetVehicleRelativeRotationVelocityPerFrame 4 _OfVehicleHandle 0@ _intoRotationVelocityXYZ 1@ 2@ 3@
0407: store_coords_to 29@ 30@ 31@ from_car 0@ with_offset 1@ 2@ 3@
00AA: store_car 0@ position_to 26@ 27@ 28@
0063: 29@ -= 26@ // (float)
0063: 30@ -= 27@ // (float)
0063: 31@ -= 28@ // (float)
0A97: 28@ = vehicle 0@ struct
28@ += 80 // X (NS) Spin
0A8C: write_memory 28@ size 4 value 29@ virtual_protect 0
28@ += 4 // Y (EW) Spin
0A8C: write_memory 28@ size 4 value 30@ virtual_protect 0
28@ += 4 // Z (NW) Spin
0A8C: write_memory 28@ size 4 value 31@ virtual_protect 0
0AB2: cleo_return 0
Code:
07DB: set_car 0@ rotation_velocity_XYZ 3.5 7.3999 8.1003 through_center_of_mass
Computes the Vehicle's XYZ Rotation Velocity Relative to its own z(Roll) Axis. The Computation uses a Relative x(Pitch) Axis and Y(Roll) Axes pinned at 0.0 degrees.
Code:
:GetVehicleRotationVelocityPerFrame_RespectItsZAngle // 0AB1: @GetVehicleRotationVelocityPerFrame_RespectItsZAngle 1 _OfVehicleHandle 0@ _StoreRotationVelocityXYZ 29@ 30@ 31@
0A97: 31@ = vehicle 0@ struct
31@ += 80 // x0 (NS) Spin
0A8D: 1@ = read_memory 31@ size 4 virtual_protect 0
31@ += 4 // y0 (EW) Spin
0A8D: 2@ = read_memory 31@ size 4 virtual_protect 0
31@ += 4 // z0 (NW) Spin
0A8D: 3@ = read_memory 31@ size 4 virtual_protect 0
0174: 31@ = car 0@ Z_angle
31@ *= -1.0 // right to left rotation becomes left to right(inverted rotation)
// SpinAnglesRotateAxisZ // http://danceswithcode.net/engineeringnotes/rotations_in_3d/rotations_in_3d_part2.html
// Initialization
02F6: 30@ = sine 31@
02F7: 29@ = cosine 31@
// x1 = x0*cos(yaw) - y0*sin(yaw)
0087: 28@ = 1@
006B: 28@ *= 29@
0087: 26@ = 2@
006B: 26@ *= 30@
0063: 28@ -= 26@
// y1 = x0*sin(yaw) + y0*cos(yaw)
0087: 27@ = 1@
006B: 27@ *= 30@
0087: 26@ = 2@
006B: 26@ *= 29@
005B: 27@ += 26@
// z1 = z0
//
0AB2: cleo_return 3 28@ 27@ 3@
Code:
:GetVehicleRotationVelocityPerFrame_RespectItsZAngle // 0AB1: @GetVehicleRotationVelocityPerFrame_RespectItsZAngle 1 _OfVehicleHandle 0@ _StoreRotationVelocityXYZ 29@ 30@ 31@
0AB1: @GetVehicleRotationVelocityPerFrame_RespectItsZAngle 1 _OfVehicleHandle 0@ _StoreRotationVelocityXYZ 28@ 27@ 3@
//
// Per Frame to Per Second Converter
0A8D: 31@ = readMem 0xB7CB5C size 4 vp 0 // gta frame time, use in order to be consistent with FPS
if 31@ == 0.0
then 31@ = 1.0
else 31@ /= 50.0
end
0073: 28@ /= 31@ // normalize xRV to Per Second
0073: 27@ /= 31@ // normalize xRV to Per Second
0073: 3@ /= 31@ // normalize xRV to Per Second
//
0AB2: cleo_return 3 28@ 27@ 3@
Code:
:SetVehicleRotationVelocityPerFrame_RespectItsZAngle // 0AB1: @SetVehicleRotationVelocityPerFrame_RespectItsZAngle 4 _OfVehicleHandle 0@ _RotationVelocityXYZ 1@ 2@ 3@
0174: 31@ = car 0@ Z_angle // no need to invert it since we are doing backward rotation
// SpinAnglesRotateAxisZ // http://danceswithcode.net/engineeringnotes/rotations_in_3d/rotations_in_3d_part2.html
// Initialization
02F6: 30@ = sine 31@
02F7: 29@ = cosine 31@
// x1 = x0*cos(yaw) - y0*sin(yaw)
0087: 28@ = 1@
006B: 28@ *= 29@
0087: 26@ = 2@
006B: 26@ *= 30@
0063: 28@ -= 26@
// y1 = x0*sin(yaw) + y0*cos(yaw)
0087: 27@ = 1@
006B: 27@ *= 30@
0087: 26@ = 2@
006B: 26@ *= 29@
005B: 27@ += 26@
// z1 = z0
//
0A97: 31@ = vehicle 0@ struct
31@ += 80
0A8C: write_memory 31@ size 4 value 28@ virtual_protect 0 // Set X (NS) Spin
31@ += 4
0A8C: write_memory 31@ size 4 value 27@ virtual_protect 0 // Set Y (EW) Spin
31@ += 4
0A8C: write_memory 31@ size 4 value 3@ virtual_protect 0 // Set Z (NW) Spin
0AB2: cleo_return 0
Code:
:SetVehicleRotationVelocityPerFrame_RespectItsZAngle // 0AB1: @SetVehicleRotationVelocityPerFrame_RespectItsZAngle 4 _OfVehicleHandle 0@ _RotationVelocityXYZ 1@ 2@ 3@
// Per Second to Per Frame Converter
0A8D: 31@ = readMem 0xB7CB5C size 4 vp 0 // gta frame time, use in order to be consistent with FPS
if 31@ == 0.0
then 31@ = 1.0
else 31@ /= 50.0
end
006B: 1@ *= 31@ // normalize RV to Per Frame
006B: 2@ *= 31@ // normalize RV to Per Frame
006B: 3@ *= 31@ // normalize RV to Per Frame
//
0AB1: @SetVehicleRotationVelocityPerFrame_RespectItsZAngle 4 _OfVehicleHandle 0@ _RotationVelocityXYZ 1@ 2@ 3@
0AB2: cleo_return 0
Computes the Vehicle's XYZ Rotation Velocity relative to the TrueNorth's Axis by NS, EW, and NW.
Code:
:GetVehicleTrueNorthRotationVelocityPerFrame // 0AB1: @GetVehicleTrueNorthRotationVelocityPerFrame 1 _OfVehicleHandle 0@ _StoreSpins: _NorthSouth 29@ _EastWest 30@ _NorthWest 31@
0A97: 27@ = vehicle 0@ struct
27@ += 80 // X (NS) Spin
0A8D: 29@ = read_memory 27@ size 4 virtual_protect 0
27@ += 4 // Y (EW) Spin
0A8D: 30@ = read_memory 27@ size 4 virtual_protect 0
27@ += 4 // Z (NW) Spin
0A8D: 31@ = read_memory 27@ size 4 virtual_protect 0
ret 3 29@ 30@ 31@
Code:
:GetVehicleTrueNorthRotationVelocityPerSecond // 0AB1: @GetVehicleTrueNorthRotationVelocityPerSecond 1 _OfVehicleHandle 0@ _StoreSpins: _NorthSouth 29@ _EastWest 30@ _NorthWest 31@
0AB1: @GetVehicleTrueNorthRotationVelocityPerFrame 1 _OfVehicleHandle 0@ _StoreSpins: _NorthSouth 29@ _EastWest 30@ _NorthWest 31@
// Per Frame to Per Second Converter
0A8D: 28@ = readMem 0xB7CB5C size 4 vp 0 // gta frame time, use in order to be consistent with FPS
if 28@ == 0.0
then 28@ = 1.0
else 28@ /= 50.0
end
0073: 29@ /= 28@ // normalize RV to Per Second
0073: 30@ /= 28@ // normalize RV to Per Second
0073: 31@ /= 28@ // normalize RV to Per Second
//
ret 3 29@ 30@ 31@
Code:
:SetVehicleTrueNorthRotationVelocityPerFrame // 0AB1: @SetVehicleTrueNorthRotationVelocityPerFrame 4 _OfVehicleHandle 0@ _intoRotationVelocityXYZ 1@ 2@ 3@
0A97: 31@ = vehicle 0@ struct
31@ += 80 // X (NS) Spin
0A8C: write_memory 31@ size 4 value 1@ virtual_protect 0
31@ += 4 // Y (EW) Spin
0A8C: write_memory 31@ size 4 value 2@ virtual_protect 0
31@ += 4 // Z (NW) Spin
0A8C: write_memory 31@ size 4 value 3@ virtual_protect 0
0AB2: cleo_return 0
Code:
:SetVehicleTrueNorthRotationVelocityPerSecond // 0AB1: @SetVehicleTrueNorthRotationVelocityPerSecond 4 _OfVehicleHandle 0@ _intoRotationVelocityXYZ 1@ 2@ 3@
// Per Second to Per Frame Converter
0A8D: 31@ = readMem 0xB7CB5C size 4 vp 0 // gta frame time, use in order to be consistent with FPS
if 31@ == 0.0
then 31@ = 1.0
else 31@ /= 50.0
end
006B: 1@ *= 31@ // normalize RV to Per Frame
006B: 2@ *= 31@ // normalize RV to Per Frame
006B: 3@ *= 31@ // normalize RV to Per Frame
//
0AB1: @SetVehicleTrueNorthRotationVelocityPerFrame 4 _OfVehicleHandle 0@ _intoRotationVelocityXYZ 1@ 2@ 3@
0AB2: cleo_return 0
Last edited: