M MY Multiplayer: Wiki
Side
Kind

getElementComponentRotation

Client

Returns the rotation of a vehicle's or object's component, in degrees.

float, float, float|false getElementComponentRotation(vehicle|object element, string component [, string base = "parent"])

Parameters

NameTypeDescription
elementvehicle|objectThe vehicle or object.
componentstringThe component's name, as getElementComponents lists it.
basestringRelative to what: "world", "root" (the element itself) or "parent" (the component's parent frame). Case does not matter.default "parent"

Returns

Three numbers rx, ry, rz in degrees, or false if the component does not exist.

Example

local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
    local rx, ry, rz = getElementComponentRotation(vehicle, "door_lf_dummy")
    outputDebugString(("Left door: %.1f, %.1f, %.1f"):format(rx, ry, rz))
end
Coming from MTAThe same as MTA's getVehicleComponentRotation, but it also works on objects.

See also