GetElementBonePosition: Difference between revisions
Jump to navigation
Jump to search
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
|||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{ | {{Added feature/item|1.5.9|1.5.8|20704|Returns the 3D world coordinates of a specific bone of a given [[element]]. Currently the [[Element/Player|Player]] and [[Element/Ped|Ped]] element types are accepted.}} | ||
{{Tip|If you want to attach an element to a bone, see [[attachElementToBone]].}} | |||
}} | |||
{{Tip|If you want to attach an element to a bone, see [[attachElementToBone]]}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float, float, float getElementBonePosition ( element theElement, int | float, float, float getElementBonePosition ( element theElement, int boneId ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theElement:''' the element to get the bone position on. | *'''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=== | ||
Returns the | Returns 3 [[Float|floats]], representing the X, Y, Z world position of the bone. | ||
==Example== | ==Example== | ||
This example outputs the | This example outputs the X, Y, Z world position of the local player bone specified through a command: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function getBonePosition( | function getBonePosition (commandName, boneId) | ||
if ( | if not tonumber (boneId) then | ||
outputChatBox("You didn't insert an ID", 255, 0, 0) | outputChatBox ("You didn't insert an bone ID!", 255, 0, 0) | ||
return false | return false | ||
end | end | ||
local x, y, z = getElementBonePosition(localPlayer, | |||
outputChatBox("The bone position is: "..x..", "..y..", "..z) | local x, y, z = getElementBonePosition (localPlayer, boneId) | ||
outputChatBox ("The bone position is: "..x..", "..y..", "..z) | |||
end | end | ||
addCommandHandler("getboneposition", getBonePosition) | |||
addCommandHandler ("getboneposition", getBonePosition) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client_element_functions}} | {{Client_element_functions}} |
Latest revision as of 17:23, 7 November 2024
Returns the 3D world coordinates of a specific bone of a given element. Currently the Player and Ped element types are accepted.
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
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneRotation
- setElementCollidableWith
- setElementStreamable
- updateElementRpHAnim
- Shared
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement