getElementComponentPosition
Client
Returns the position of a vehicle's or object's component.
float, float, float|false getElementComponentPosition(vehicle|object element, string component [, string base = "root"])
Parameters
| Name | Type | Description |
|---|---|---|
| element | vehicle|object | The vehicle or object. |
| component | string | The component's name, as getElementComponents lists it. |
| base | string | Relative to what: "world", "root" (the element itself) or "parent" (the component's parent frame). Case does not matter.default "root" |
Returns
Three numbers x, y, z, or false if the component does not exist.
Example
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
local x, y, z = getElementComponentPosition(vehicle, "bonnet_dummy", "world")
if x then
outputDebugString(("Bonnet at %.1f, %.1f, %.1f"):format(x, y, z))
end
endComing from MTAThe same as MTA's
getVehicleComponentPosition, but it also works on objects.