GetVehicleRotation: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
m (tweak note) |
||
(18 intermediate revisions by 13 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
{{Deprecated|getElementRotation|}} | |||
This function gets the rotation of a vehicle along the X, Y, and Z axes in degrees. | |||
{{Note|1=Rotation Z returns value in CCW (counter-clock wise). So 3 o'clock is not 90 degrees, it's actually 270 degrees and 9 o'clock is not 270 degrees, it's 90 degrees. '''To fix this use: rotZ = (360-rotZ)''' }} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">float float float getVehicleRotation ( vehicle theVehicle )</syntaxhighlight> | |||
===Required Arguments=== | |||
*'''theVehicle''': 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== | ==Example== | ||
This example creates a vehicle and gets its rotation: | |||
<syntaxhighlight lang="lua">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 | |||
</syntaxhighlight> | |||
==See Also== | |||
{{Vehicle functions}} | |||
Latest revision as of 08:27, 7 September 2019
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use getElementRotation instead. |
This function gets the rotation of a vehicle along the X, Y, and Z axes in degrees.
Syntax
float float float getVehicleRotation ( vehicle theVehicle )
Required Arguments
- theVehicle: 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
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates