- Documentation
- Client functions
- getPedBoneTransform
Function
getPedBoneTransform
Returns both the position and rotation of a ped's bone at once (x, y, z, rx, ry, rz), which is faster than calling getPedBonePosition and getPedBoneRotation separately every frame. Values come from the current animation frame in this game.
Syntax
float, float, float, float, float, float getPedBoneTransform(ped ped, int bone)Arguments
pedped- A player or an NPC.
boneint- Bone number (as in
getBoneIDs) or a game bone index.
Returns
x, y, z and rx, ry, rz in degrees, or false.
Example
local x, y, z, rx, ry, rz = getPedBoneTransform(localPlayer, 25)
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.getPedBoneRotationReturns 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.