natiny.model.set_bone_weight

Lua
natiny.model.set_bone_weight(model, bone, weight)

Sets how much of a bone the game has taken over from the animation, so that a head can follow the camera or a hand can be pinned to a ledge.

Parameters

Name Type Description
model number Model handle
bone number Bone entity from get_bone
weight number 0 leaves the bone to the animation, 1 to what was written into it; clamped to that range

Example

Lua
local head = natiny.model.get_bone(hero, "Head")
natiny.model.set_bone_weight(hero, head, 1.0)

--  Written once, and kept until it is written again.
natiny.entity.set_rotation(head, natiny.entity.SPACE_LOCAL, pitch, yaw, 0)