M MY Multiplayer: Wiki
Side
Kind

getElementBoneQuaternion

Client

Returns the orientation of a ped's or object's bone relative to its parent bone, as a quaternion.

quat|false getElementBoneQuaternion(ped|object element, int|string bone)

Parameters

NameTypeDescription
elementped|objectThe ped, player or object. An object needs a model with a skeleton or a node tree.
boneint|stringThe 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 quat (x, y, z, w), or false if the element is streamed out or the bone has no pose.

Example

local saved = getElementBoneQuaternion(localPlayer, 5)

addEventHandler("onClientPedsProcessed", root, function()
    if saved then
        setElementBoneQuaternion(localPlayer, 5, saved)
    end
end)
Coming from MTAIn MTA it works on peds only and returns four 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.

See also