- Documentation
- Shared functions
- attachElements
Function
attachElements
Attaches an element to another. The attached element moves and rotates together with the one it is attached to. An object attached to a vehicle is carried by the game in the same frame as the vehicle physics, so it stays exactly in place even at high speed and in turns.
Syntax
bool attachElements(element theElement, element theAttachToElement [, float xPosOffset = 0, float yPosOffset = 0, float zPosOffset = 0, float xRotOffset = 0, float yRotOffset = 0, float zRotOffset = 0])Arguments
theElementelement- The element to attach.
theAttachToElementelement- The element to attach to.
xPosOffsetfloat, optional = 0- X offset.
yPosOffsetfloat, optional = 0- Y offset.
zPosOffsetfloat, optional = 0- Z offset.
xRotOffsetfloat, optional = 0- X rotation.
yRotOffsetfloat, optional = 0- Y rotation.
zRotOffsetfloat, optional = 0- Z rotation.
Returns
true on success.
Example
A beacon on a police car's roof.
local car = createVehicle(596, 1545, -1675, 13.4)
local light = createObject(1210, 0, 0, 0)
attachElements(light, car, 0, -0.2, 0.95)