ang_for_bone(ANGLE*, ENTITY*, STRING*)

Calculates the absolute Euler angle of a bone, including the entity rotation. This can be used to attach weapons or other equipment to a certain bone of an actor.

Parameters:

ANGLE* - to be set to the Euler angle.
ENTITY* - model entity pointer.
STRING* - bone name.

Modifies

ANGLE*

Speed:

Fast

Remarks:

Example:

action attach_gun_to_actor
{
var anim_percent = 0; you = ent_create("gun.mdl",0,NULL); // create a gun for the actor
while(1) {
anim_percent += time_step;
ent_animate(me,"walk",anim_percent,ANM_CYCLE); // animate the actor
vec_for_bone(your.x,my,"RightHand"); // place gun at hand position
ang_for_bone(your.pan,my,"RightHand"); // rotate gun by hand angle
wait(1);
}
}

See also:

vec_for_bone ► latest version online