GetElementBoneQuaternion: Difference between revisions
Jump to navigation
Jump to search
(Add documentation) Β |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) Β |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
{{Client function}} | {{Client function}} | ||
{{New feature/item|3.0161|1.6.0| | {{New feature/item|3.0161|1.6.0|22741| | ||
This function retrieves how a particular bone rotates in relation to the element.<br/> | This function retrieves how a particular bone rotates in relation to the element.<br/> | ||
The use of [https://en.wikipedia.org/wiki/Quaternion quaternions] are more effective and do not generate issues like gimbal lock that might arise with [https://en.wikipedia.org/wiki/Euler_angles Euler angles], so they are a preferable choice for rotation. | The use of [https://en.wikipedia.org/wiki/Quaternion quaternions] are more effective and do not generate issues like gimbal lock that might arise with [https://en.wikipedia.org/wiki/Euler_angles Euler angles], so they are a preferable choice for rotation. | ||
Line 23: | Line 23: | ||
* '''z:''' The quaternion's coefficient of the π component, representing rotation around the z-axis. | * '''z:''' The quaternion's coefficient of the π component, representing rotation around the z-axis. | ||
* '''w:''' The real part of the quaternion, which is linked to the angle of rotation. | * '''w:''' The real part of the quaternion, which is linked to the angle of rotation. | ||
==Example== Β | ==Example== Β | ||
This example retrieves the rotation of the player's head in quaternion.<br/> | This example retrieves the rotation of the player's head in quaternion.<br/> | ||
The retrieved values ββcan be used for calculations. | The retrieved values ββcan be used for calculations. | ||
Line 41: | Line 37: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client_element_functions}} | {{Client_element_functions}} |
Latest revision as of 17:35, 7 November 2024
Syntax
int, int, int, int getElementBoneQuaternion(element ped, int bone)
Required Arguments
- ped: The element (ped or player) from which the bone's rotation will be retrieved.
- bone: The ID of the bone to retrieve the quaternion of.
- The bone ID corresponds to specific body parts like arms, legs, spine, head, etc.
- The full list of bones is available in the Bone IDs reference.
Returns
Returns four float values:
- x: The quaternion's coefficient of the π component, representing rotation around the x-axis.
- y: The quaternion's coefficient of the π component, representing rotation around the y-axis.
- z: The quaternion's coefficient of the π component, representing rotation around the z-axis.
- w: The real part of the quaternion, which is linked to the angle of rotation.
Example
This example retrieves the rotation of the player's head in quaternion.
The retrieved values ββcan be used for calculations.
local playerBone = 1 local playerBoneX, playerBoneY, playerBoneZ, playerBoneW addEventHandler("onClientResourceStart", resourceRoot, function() playerBoneX, playerBoneY, playerBoneZ, playerBoneW = getElementBoneQuaternion(localPlayer, playerBone) end )
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