Skip to main content

Bone

Bone holds the bones of a character's skeleton: the body parts (head, hands, feet, spine, ...) and the helper points the game attaches things to (weapons, the grappling hook, the parachute). Use it to get where a body part of a player is, for example to draw a name tag above the head.

Available on: Client

Values​

Bone​

Each value is a 32-bit hash of the bone's name. The values are opaque numbers: compare and pass them, don't do math on them.

Used by player:GetBonePosition(bone) (client): the world position of that bone of a player whose character is spawned in the local game, smoothed for rendering (so it matches what is drawn this frame). It returns vec3(0, 0, 0) when the character's skeleton has no such bone, and nil while the player's character isn't spawned in the local game (for example when the player is too far away).

All the bones below are part of the standard human skeleton the player characters use. Clothing flaps and some attach points may not exist on every skin.

NameValueMeaning
Bone.Reference0x8EB2FD7CThe root of the skeleton, on the ground under the character.
Bone.Offset0x4AAA87DBThe skeleton's offset bone, just above the root.
Bone.Hips0x58C4C160The hips (pelvis), the center of the body.
Bone.Spine10xF3799475The lower spine.
Bone.Spine20xCF4D7850The middle spine.
Bone.Spine30xC026B1C5The upper spine (chest).
Bone.Neck10x57047F29The neck.
Bone.Sternum0x5CBE0CD3The sternum (front of the chest).
Bone.Head0xF625B09EThe head.
Bone.Face0xC8A9BE24The face.
Bone.RightToe0x11BA16C9The right toes.
Bone.LeftToe0xF41B831FThe left toes.
Bone.RightFoot0xCF06D4B4The right foot.
Bone.LeftFoot0x998F5535The left foot.
Bone.RightLegLower0x79FB24DDThe right lower leg (shin).
Bone.LeftLegLower0x22804AABThe left lower leg (shin).
Bone.RightLegUpper0x95D671DBThe right upper leg (thigh).
Bone.LeftLegUpper0x7DE5F931The left upper leg (thigh).
Bone.RightShoulder0x92364388The right shoulder.
Bone.LeftShoulder0xB433045CThe left shoulder.
Bone.RightArmUpper0x16A6973EThe right upper arm.
Bone.LeftArmUpper0x2166D7EBThe left upper arm.
Bone.RightArmLower0xFBA1FF35The right forearm.
Bone.LeftArmLower0x50676626The left forearm.
Bone.RightHand0x624CC24EThe right hand.
Bone.LeftHand0xDBF07C45The left hand.
Bone.RightHandAttach0x52E64FA0Where things are held in the right hand (weapons).
Bone.LeftHandAttach0x5A359B5EWhere things are held in the left hand.
Bone.RightHandAttach20x6E874912A second attach point on the right hand.
Bone.LeftHandAttach20x2249E6F4A second attach point on the left hand.
Bone.RightHandIK0x2C4A76E9The right hand's inverse kinematics target.
Bone.LeftHandIK0x875F50E3The left hand's inverse kinematics target.
Bone.RightBackAttach0xB5FABBC4Attach point on the right of the back (holstered weapons).
Bone.LeftBackAttach0x76161674Attach point on the left of the back (holstered weapons).
Bone.RightLegAttach0xD46A3E5EAttach point on the right leg (holstered weapons).
Bone.LeftLegAttach0x9154B8F0Attach point on the left leg (holstered weapons).
Bone.RightFootIK0xD0180B1AThe right foot's inverse kinematics target.
Bone.LeftFootIK0xDE30B0A4The left foot's inverse kinematics target.
Bone.AimTarget0x33AB1422The aim target helper.
Bone.TargetRef10x013DBFD0Targeting reference point 1.
Bone.TargetRef20x8497EC9DTargeting reference point 2.
Bone.CameraRef10xB03A2552Camera reference point 1.
Bone.CameraRef20x591C2AA2Camera reference point 2.
Bone.GrappleAttachHook0xCE85F29DWhere the grappling hook sits.
Bone.GrappleAttachWire0x50676626Where the grapple wire leaves the arm. Same value as Bone.LeftArmLower, so it gives the same position.
Bone.GrappleAttachBelt0x58C4C160The grapple's belt attach point. Same value as Bone.Hips, so it gives the same position.
Bone.GrappleAttachWrist0xDA0E5D79The grapple's wrist attach point.
Bone.RightParaAttach0xA65EA5AFRight parachute strap attach point.
Bone.LeftParaAttach0x39AC18D0Left parachute strap attach point.
Bone.RightParaAttach20xC1CFBFCCSecond right parachute strap attach point.
Bone.LeftParaAttach20x3909E2BESecond left parachute strap attach point.
Bone.RightFrontFlap0x2E75FACBRight front clothing flap.
Bone.LeftFrontFlap0xD2A2B635Left front clothing flap.
Bone.RightBackFlap0x7515F275Right back clothing flap.
Bone.LeftBackFlap0x5A9D096FLeft back clothing flap.
Bone.CollarLeftFlap0xBE59988CLeft collar flap.
Bone.CollarRightFlap0x53343E2CRight collar flap.
Bone.CollarBackFlap0x3D2E5DD6Back collar flap.

Example

-- client: print where the local player's head and hands are
Cmd.Add("bones", function()
local player = World.LocalPlayer():AsPlayer()

for _, name in ipairs({ "Head", "RightHand", "LeftHand", "RightFoot" }) do
local position = player:GetBonePosition(Bone[name]) or vec3(0, 0, 0)
print(string.format("%s: %.2f %.2f %.2f", name, position.x, position.y, position.z))
end
end)

-- client: show a screen marker 30 cm above every player's head
Event.Add("OnRender", function()
for _, client in ipairs(World.GetPlayers()) do
local player = client:GetPlayer()

if player then
local head = player:AsPlayer():GetBonePosition(Bone.Head)
local screen = head and Camera.WorldToScreen(head + vec3(0, 0.3, 0))

if screen then
-- draw something at screen.x, screen.y
end
end
end
end)