getElementBoneQuaternion | Multi Theft Auto: Wiki Skip to content

getElementBoneQuaternion

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function retrieves how a particular bone rotates in relation to the element.

The use of quaternions are more effective and do not generate issues like gimbal lock that might arise with Euler angles, so they are a preferable choice for rotation.

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.

Returns

  • int: value1
  • int: value2
  • int: value3
  • int: value4

Returns four float values:

Code Examples

shared

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

Element Functions