setElementBonePosition
Client-side
Server-side
Shared
Pair: getElementBonePosition
This function sets the position of a bone to the specified coordinates. Currently the player and ped element types are accepted.
Note
You need to use this function together with onClientPedsProcessed.
Tip
If you want to attach an element to a bone, see pAttach.
Syntax
bool setElementBonePosition ( element theElement, int bone, float x, float y, float z )Required Arguments
- theElement: The element to set the bone position on.
- bone: The ID of the bone to set the position of. See Bone IDs.
- x: The X coordinate of the destination.
- y: The Y coordinate of the destination.
- z: The Z coordinate of the destination.
Returns
- bool: result
Returns true if the function was successful, false otherwise.
Code Examples
client
This example shows a surprised CJ with a long neck.
local bones = { [4] = {0, 0, 0.15}, [5] = {0, 0, 0.15}, [6] = {0, 0, 0.13}, [7] = {0, 0, 0.13}, [8] = {0, 0, 0.1},}
function updatePed() for bone, v in pairs(bones) do local boneX, boneY, boneZ = getElementBonePosition(localPlayer, bone) setElementBonePosition(localPlayer, bone, boneX + v[1], boneY + v[2], boneZ + v[3]) endendaddEventHandler("onClientPedsProcessed", root, updatePed)See Also
Element Functions
- addElementDataSubscriber
- attachElements
- clearElementVisibleTo
- cloneElement
- createElement
- destroyElement
- detachElements
- getAllElementDataUpdated
- getAttachedElements
- getElementAlpha
- getElementAngularVelocity
- getElementAttachedOffsets
- getElementAttachedTo
- getElementBonePosition
- getElementBoneQuaternionNew
- getElementBoneRotation
- getElementBoundingBox
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getElementDimension
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementHealth
- getElementID
- getElementInterior
- getElementLighting
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRadius
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementSyncer
- getElementType
- getElementVelocity
- getElementZoneName
- getLowLODElement
- getRootElement
- hasElementData
- hasElementDataSubscriber
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementCollidableWith
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLocal
- isElementLowLOD
- isElementOnFireNew
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementVisibleTo
- isElementWaitingForGroundToLoad
- isElementWithinColShape
- isElementWithinMarker
- removeElementData
- removeElementDataSubscriber
- setElementAlpha
- setElementAngularVelocity
- setElementAttachedOffsets
- setElementBonePosition
- setElementBoneQuaternionNew
- setElementBoneRotation
- setElementCallPropagationEnabled
- setElementCollidableWith
- setElementCollisionsEnabled
- setElementDataUpdated
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementLightingNew
- setElementMatrix
- setElementModel
- setElementOnFireNew
- setElementParent
- setElementPosition
- setElementRotation
- setElementStreamable
- setElementSyncer
- setElementVelocity
- setElementVisibleTo
- setLowLODElement
- updateElementRpHAnim
Element Events
- onClientElementColShapeHit
- onClientElementColShapeLeave
- onClientElementDataChange
- onClientElementDestroy
- onClientElementDimensionChange
- onClientElementInteriorChange
- onClientElementModelChange
- onClientElementStreamIn
- onClientElementStreamOut
- onElementClicked
- onElementColShapeHit
- onElementColShapeLeave
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStartSync
- onElementStopSync
