setElementBoneQuaternion | Multi Theft Auto: Wiki Skip to content

setElementBoneQuaternion

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 determines 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.

Note

If you want to apply the rotation, updateElementRpHAnim must be called after this function.

Tip

If you want to attach an element to a bone, see attachElementToBone .

Syntax

bool setElementBoneQuaternion ( element ped, int bone, float x, float y, float z, float w )
Required Arguments
  • ped: The element (ped or player) on which the bone's rotation will be set.
  • bone: The ID of the bone to set the quaternion of.
  • x: MISSING_PARAM_DESC
  • y: MISSING_PARAM_DESC
  • z: MISSING_PARAM_DESC
  • w: MISSING_PARAM_DESC

Returns

  • bool: value

Returns true if the set was successful, otherwise returns an error message and returns false .

Code Examples

shared

This example rotates the player's pelvis 180 degrees around an arbitrary axis.The use ofupdateElementRpHAnimis necessary here as it applies the rotation.

local playerBone = 1
local playerBoneX, playerBoneY, playerBoneZ = 0.577, 0.577, 0.577
local playerBoneW = 0
addEventHandler("onClientPedsProcessed", root,
function()
setElementBoneQuaternion(localPlayer, playerBone, playerBoneX, playerBoneY, playerBoneZ, playerBoneW)
updateElementRpHAnim(localPlayer)
end
)

See Also

Element Functions