- Documentation
- Client functions
- getPedBoneRotation
Function
getPedBoneRotation
Returns the world rotation of a chosen skeleton bone of a ped, in degrees, exactly as it looks in the current animation frame. Works for peds visible in this game. Useful for attaching objects to a hand or the head so they rotate with it.
Syntax
float, float, float getPedBoneRotation(ped ped, int bone)Arguments
pedped- A player or an NPC.
boneint- Bone number (as in
getBoneIDs) or a game bone index (as ingetPedBonePosition).
Returns
Rotation rx, ry, rz in degrees (rz: 0 = north), or false.
Example
local rx, ry, rz = getPedBoneRotation(localPlayer, 6)
See also
getPedBonePositionReturns the world position of a chosen skeleton bone of a ped, such as the head or a hand. On the client the position is exact and follows the animation (the bone is read from the game). The server does not know the ped's pose, so it returns an approximation: a fixed bone offset of a standing ped, rotated to match its heading. Bone numbers are the ones fromgetBoneIDs(e.g. 8 head, 25 right hand, 35 left hand); on the client a game bone index also works.getPedBoneTransformReturns both the position and rotation of a ped's bone at once (x, y, z, rx, ry, rz), which is faster than callinggetPedBonePositionandgetPedBoneRotationseparately every frame. Values come from the current animation frame in this game.