natiny.model.get_bone

Lua
natiny.model.get_bone(model, name) -> bone

Returns one bone of this model as an entity, so that things can be parented to it and its transform read.

Parameters

Name Type Description
model number Model handle
name string Bone name as natiny.mesh.get_bone_name reports it

Returns

Type Description
number Entity handle for the bone, or nil when there is no bone of that name

Example

Lua
local hand = natiny.model.get_bone(hero, "Middle2.R")
natiny.entity.set_parent(sword, hand)

local x, y, z = natiny.entity.get_position(hand, natiny.entity.SPACE_WORLD)

Notes

  • Destroying the model destroys its bones and their children.