setElementComponentPosition
Client
Moves a vehicle's or object's component. The change applies on this client only.
bool setElementComponentPosition(vehicle|object element, string component, float x, y, z [, string base = "root"])
Parameters
| Name | Type | Description |
|---|---|---|
| element | vehicle|object | The vehicle or object. |
| component | string | The component's name, as getElementComponents lists it. |
| x, y, z | float | The new position, as three numbers or one vec3. |
| base | string | Relative to what: "world", "root" (the element itself) or "parent" (the component's parent frame). Case does not matter.default "root" |
Returns
true if it was moved, false if the component does not exist.
The position is kept while the element exists, and comes back when it streams in again. Whatever is attached to the component follows it.
Example
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
local x, y, z = getElementComponentPosition(vehicle, "bonnet_dummy")
setElementComponentPosition(vehicle, "bonnet_dummy", x, y, z + 0.3)
endComing from MTAThe same as MTA's
setVehicleComponentPosition, but it also works on objects.