Calculating coords for points behind vehicle (math)
#4

You could use the ZAngle but that will only work on flat ground, to do that accurate you need to use GetVehicleRotationQuat
Combine one of these with GetVehicleModelInfo to get behind (+ your offset) of the vehicle

For the ZAngle you could reuse this function
PHP код:
GetInFrontOfAngle(Floatangle, &Float:x, &Float:yFloat:distance) {
    
-= distance floatsin(angledegrees);
    
+= distance floatcos(angledegrees);

PHP код:
new FloatxFloatyFloatzFloata;
GetVehiclePos(vehicleidxyz); 
GetVehicleZAngle(vehicleida); // a is facing to the front
// a + 180 = behind | a - 90 = right | a + 90 = left
GetInFrontOfAngle(180.0xy5.0); // 5.0 behind vehicle center
GetInFrontOfAngle(90.0xy3.0); // 5.0 behind, 3.0 to the right
// save current position in new variables
new FloatfirstX xFloatfirstY y;
GetInFrontOfAngle(90.0xy7.0); // 5.0 behind, 4.0 (3.0 - 7.0) to the left
new FloatsecondX xFloatsecondY y;
// and so on 
For the quat solution search for an include
Reply


Messages In This Thread
Calculating coords for points behind vehicle (math) - by Riwerry - 10.09.2018, 01:41
Re: Calculating coords for points behind vehicle (math) - by AmirSavand - 10.09.2018, 01:46
Re: Calculating coords for points behind vehicle (math) - by Riwerry - 10.09.2018, 01:48
Re: Calculating coords for points behind vehicle (math) - by Nero_3D - 10.09.2018, 02:34

Forum Jump:


Users browsing this thread: 2 Guest(s)