Skip to content

Commit d1294b9

Browse files
authored
Declare GetVehicleMatrix and GetVehicleRotation
these functions are already present in docs and server implementation
1 parent 03b1f55 commit d1294b9

1 file changed

Lines changed: 46 additions & 15 deletions

File tree

omp_vehicle.inc

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,9 @@ native bool:SetVehiclePos(vehicleid, Float:x, Float:y, Float:z);
579579
* <param name="vehicleid">The ID of the vehicle to get the z angle of</param>
580580
* <param name="angle">A float variable in which to store the z rotation, passed by reference</param>
581581
* <seealso name="GetVehicleRotationQuat" />
582-
* <seealso name="GetVehicleRotation" />
583582
* <seealso name="SetVehicleZAngle" />
584583
* <seealso name="GetVehiclePos" />
584+
* <seealso name="GetVehicleMatrix" />
585585
* <seealso name="GetPlayerFacingAngle" />
586586
* <returns>
587587
* <b><c>1</c></b>: The function executed successfully.<br />
@@ -599,20 +599,8 @@ native bool:GetVehicleZAngle(vehicleid, &Float:angle);
599599
* <param name="y">A float variable in which to store the third quaternion angle, passed by reference</param>
600600
* <param name="z">A float variable in which to store the fourth quaternion angle, passed by reference</param>
601601
* <seealso name="GetVehicleZAngle" />
602-
* <remarks>
603-
* <b>To euler:</b><br />
604-
* <code>
605-
* // GetVehicleRotation Created by IllidanS4<br />
606-
* stock GetVehicleRotation(vehicleid, &amp;Float:rx, &amp;Float:ry, &amp;Float:rz)<br />
607-
* {<br />
608-
* new Float:qw, Float:qx, Float:qy, Float:qz;<br />
609-
* GetVehicleRotationQuat(vehicleid, qw, qx, qy, qz);<br />
610-
* rx = asin((2 * qy * qz) - (2 * qx * qw));<br />
611-
* ry = -atan2((qx * qz) + (qy * qw), 0.5 - (qx * qx) - (qy * qy));<br />
612-
* rz = -atan2((qx * qy) + (qz * qw), 0.5 - (qx * qx) - (qz * qz));<br />
613-
* }
614-
* </code>
615-
* </remarks>
602+
* <seealso name="GetVehicleRotation" />
603+
* <seealso name="GetVehicleMatrix" />
616604
* <remarks>There is no 'set' variation of this function; you can not SET a vehicle's rotation (apart
617605
* from the <a href="#SetVehicleZAngle">z angle</a>) </remarks>
618606
* <remarks>This function may return incorrect values for unoccupied vehicles. The reason is that the
@@ -625,6 +613,49 @@ native bool:GetVehicleZAngle(vehicleid, &Float:angle);
625613
*/
626614
native bool:GetVehicleRotationQuat(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z);
627615

616+
/**
617+
* <library>omp_vehicle</library>
618+
* <summary>Gets the actual rotation matrix of the vehicle.</summary>
619+
* <param name="vehicleid">The ID of the vehicle</param>
620+
* <param name="rightX">A float variable in which to store the rightX coordinate, passed by reference</param>
621+
* <param name="rightY">A float variable in which to store the rightY coordinate, passed by reference</param>
622+
* <param name="rightZ">A float variable in which to store the rightZ coordinate, passed by reference</param>
623+
* <param name="upX">A float variable in which to store the upX coordinate, passed by reference</param>
624+
* <param name="upY">A float variable in which to store the upY coordinate, passed by reference</param>
625+
* <param name="upZ">A float variable in which to store the upZ coordinate, passed by reference</param>
626+
* <param name="atX">A float variable in which to store the atX coordinate, passed by reference</param>
627+
* <param name="atY">A float variable in which to store the atY coordinate, passed by reference</param>
628+
* <param name="atZ">A float variable in which to store the atZ coordinate, passed by reference</param>
629+
* <seealso name="GetVehicleRotationQuat" />
630+
* <returns>
631+
* <b><c>1</c></b>: The function executed successfully.<br />
632+
* <b><c>0</c></b>: The function failed to execute. This means the vehicle specified does not exist.
633+
* </returns>
634+
*/
635+
native bool:GetVehicleMatrix(vehicleid, &Float:rightX, &Float:rightY, &Float:rightZ, &Float:upX, &Float:upY, &Float:upZ, &Float:atX, &Float:atY, &Float:atZ);
636+
637+
/**
638+
* <library>omp_vehicle</library>
639+
* <summary>Returns a vehicle's rotation as euler.</summary>
640+
* <param name="vehicleid">The ID of the vehicle to get the rotation of</param>
641+
* <param name="x">A float variable in which to store the X axis angle, passed by reference</param>
642+
* <param name="y">A float variable in which to store the Y axis angle, passed by reference</param>
643+
* <param name="z">A float variable in which to store the Z axis angle, passed by reference</param>
644+
* <seealso name="GetVehicleZAngle" />
645+
* <seealso name="GetVehicleRotationQuat" />
646+
* <seealso name="GetVehicleMatrix" />
647+
* <remarks>There is no 'set' variation of this function; you can not SET a vehicle's rotation (apart
648+
* from the <a href="#SetVehicleZAngle">z angle</a>) </remarks>
649+
* <remarks>This function may return incorrect values for unoccupied vehicles. The reason is that the
650+
* third row of the vehicle's internal rotation matrix gets corrupted if it gets updated while unoccupied.
651+
* </remarks>
652+
* <returns>
653+
* <b><c>1</c></b>: The function executed successfully.<br />
654+
* <b><c>0</c></b>: The function failed to execute. This means the vehicle specified does not exist.
655+
* </returns>
656+
*/
657+
native bool:GetVehicleRotation(vehicleid, &Float:x, &Float:y, &Float:z);
658+
628659
/**
629660
* <library>omp_vehicle</library>
630661
* <summary>This function can be used to calculate the distance (as a float) between a vehicle and another

0 commit comments

Comments
 (0)