GetElementBonePosition

From Multi Theft Auto: Wiki
Revision as of 17:23, 7 November 2024 by Fernando187 (talk | contribs) (Remove obsolete Requirements section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Returns the 3D world coordinates of a specific bone of a given element. Currently the Player and Ped element types are accepted.

[[{{{image}}}|link=|]] Tip: If you want to attach an element to a bone, see attachElementToBone.

Syntax

float, float, float getElementBonePosition ( element theElement, int boneId )

Required Arguments

  • theElement: the element to get the bone position on.
  • boneId: the ID of the bone to get the position of. See Bone IDs.

Returns

Returns 3 floats, representing the X, Y, Z world position of the bone.

Example

This example outputs the X, Y, Z world position of the local player bone specified through a command:

function getBonePosition (commandName, boneId)
    if not tonumber (boneId) then
        outputChatBox ("You didn't insert an bone ID!", 255, 0, 0)
        return false
    end

    local x, y, z = getElementBonePosition (localPlayer, boneId)
    outputChatBox ("The bone position is: "..x..", "..y..", "..z)
end

addCommandHandler ("getboneposition", getBonePosition)

See Also