setElementBoneQuaternion | Multi Theft Auto: Wiki Skip to content

setElementBoneQuaternion

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

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

setElementBoneQuaternion ( )

Code Examples

client

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