GetVehicleRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Removed reference to depreciated variants, fixed typo)
Line 10: Line 10:


===Returns===
===Returns===
Returns three ''floats'' indicating the X, Y, and Z rotations of the vehicle in degrees (one ''float'' for a variant function), or ''false'' if the specified vehicle does not exist.
Returns three ''floats'' indicating the X, Y, and Z rotations of the vehicle in degrees, or ''false'' if the specified vehicle does not exist.


==Example==
==Example==
This example creates a vehicle and gets it's rotation:
This example creates a vehicle and gets its rotation:
<syntaxhighlight lang="lua">local newcar = createVehicle ( 520, 1024, 1024, 1024 ) -- create a Hydra
<syntaxhighlight lang="lua">local newHydra = createVehicle ( 520, 1024, 1024, 1024 ) -- create a Hydra
local rx, ry, rz = getVehicleRotation ( newcar ) -- get the vehicle's x, y and z rotations and store them in rx, ry, and rz
local rx, ry, rz = getVehicleRotation ( newHydra ) -- get the vehicle's x, y and z rotations and store them in rx, ry, and rz
outputChatBox ( "Current rotation: " .. rx .. " " .. ry .. " " .. rz ) -- output the rotations
outputChatBox ( "Current rotation: " .. rx .. " " .. ry .. " " .. rz ) -- output the rotations
</syntaxhighlight>
</syntaxhighlight>

Revision as of 15:40, 4 August 2007

Description

This function gets the rotation of a vehicle along the X, Y, and Z axes in degrees.

Syntax

float float float getVehicleRotation ( vehicle )

Required Arguments

  • vehicle: The vehicle whose rotation you want to retrieve.

Returns

Returns three floats indicating the X, Y, and Z rotations of the vehicle in degrees, or false if the specified vehicle does not exist.

Example

This example creates a vehicle and gets its rotation:

local newHydra = createVehicle ( 520, 1024, 1024, 1024 ) -- create a Hydra
local rx, ry, rz = getVehicleRotation ( newHydra ) -- get the vehicle's x, y and z rotations and store them in rx, ry, and rz
outputChatBox ( "Current rotation: " .. rx .. " " .. ry .. " " .. rz ) -- output the rotations

See Also