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

Returns the parent handle of a bone with a given name, handle, or index number.

Parameters:

ENTITY* entity pointer
name name or handle of the bone (STRING* or char*), or NULL when only the index number is given.
index The index number of the bone, or 0 when the bone name or handle is given.

Returns:

char*, handle of the bone parent, or NULL if the bone has no parent.

Modifies:

name (when both name and index are nonzero) .

Remarks:

Speed:

Fast

Edition

 A7.08 

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
}

See also:

vec_for_bone, ent_bonename, ent_bones

► latest version online