GetVehicleRotationQuat
Description:
Function GetVehicleRotationQuat returns a vehicle's rotation on all axes as a quaternion (https://en.wikipedia.org/wiki/Quaternions%20and%20spatial%20rotation).
Function GetVehicleRotationQuat was added in 0.3 and will not work in earlier versions! |
|
Parameters:
(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z)
int | vehicleid | The ID of the vehicle to get the rotation of. |
float | w | A float variable in which to store the first quaternion angle, passed by reference. |
float | x | A float variable in which to store the second quaternion angle, passed by reference. |
float | y | A float variable in which to store the third quaternion angle, passed by reference. |
float | z | A float variable in which to store the fourth quaternion angle, passed by reference. |
Return Values:
- 1: The function was executed successfully.
- 0: The function failed to execute. This means the vehicle specified does not exist.
- The vehicle's rotation is stored in the specified variables.
Examples:
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/flip", true) == 0) { new currentveh; new Float:angle; currentveh = GetPlayerVehicleID(playerid); GetVehicleZAngle(currentveh, angle); SetVehicleZAngle(currentveh, angle); SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped."); return 1; } return 0; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetVehicleZAngle: Check the current angle of a vehicle.
- SetVehiclePos: Set the position of a vehicle.