ent_bonehandle(ENTITY*,STRING* name,var index)

ent_boneparent(ENTITY*,STRING* name,var index)

Finds the handle and optionally the name of a bone (ent_bonehandle, A7.81) or of the 'parent' bone to which a bone with the given index number is attached (ent_boneparent, A7.10).



Entity pointer

name Name of the bone (STRING* or char*), either input to or output from the function, or NULL.
index Index number of the bone, or 0 when STRING* contains the bone name or handle.


Handle of the bone resp. bone parent (0 if the bone has no parent).


name (set to the name of the bone resp. parent bone when both name and index are nonzero) .




Example (lite-C):

// return the handle of the first child bone of a bone with a given index
long ent_bonechild(ENTITY* ent,var index)
  var i;
  for (i=1; i<=ent_bones(ent); i++)
    if (index == ent_boneparent(ent,NULL,i))
      return (long)i;
  return 0; // no child found

// get the name of the parent bone when a child index is given.
STRING* parent_name = "";
ent_setboneparent(ent,parent_name,child_index); // retrieve the parant name from the child index.

// get the name of the parent bone when a child name is given.
STRING* child_name = "foot_left";
long handle = ent_setboneparent(ent,child_name,0); // return a handle to the parent bone
ent_setbonehandle(ent,parent_name,(var)handle); // retrieve the parant name from the parent handle.

See also:

vec_for_bone, ent_bonename, ent_bones

► latest version online