getElementBonePosition
Client
Returns the world position of a ped's or object's bone.
vec3|false getElementBonePosition(ped|object element, int|string bone)
Parameters
| Name | Type | Description |
|---|---|---|
| element | ped|object | The ped, player or object. An object needs a model with a skeleton or a node tree. |
| bone | int|string | The bone. On a ped: an MTA bone id, a rig bone's tag or its name. On an object: a node's name or a bone's tag. |
Returns
A vec3 with the position, or false if the element is streamed out or the ped has no such bone.
Example
addEventHandler("onClientRender", root, function()
local hand = getElementBonePosition(localPlayer, 24)
if hand then
dxDrawLine3D(hand.x, hand.y, hand.z, hand.x, hand.y, hand.z + 1, tocolor(255, 0, 0))
end
end)Coming from MTAIn MTA it works on peds only and returns three numbers. Here it also takes objects and rig bones by tag or name.
NoteRaises an error if the element has no such bone. While the element is streamed out, it returns
false.