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:
- Entity scene and bone names must consist of at least 3 characters.
- If a name STRING plus an index number are given, name is set to the name of the bone.
- The index number is the number of the bone, starting with 1. By calling this function in a loop over the index number from 1 to ent_bones(), the structure of the whole skeleton can be determined.
- A bone handle is the integer number of the bone, starting with 1. A var index can be converted to a bone handle by casting it to long (char* handle = (long)index).
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