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.
ANGLE* - to be set to the Euler angle.
ENTITY* - model entity pointer.
STRING* - bone name.
- For retrieving the Euler angle, the bone must be rotated only. Scaled or blended bones (ent_blendpose) have no defined angles and this function will not work on them.
- This function updates the entity to its current position and orientation; therefore the entity angles must be set before calling ang_for_bone.
var anim_percent = 0;
you = ent_create("gun.mdl",0,NULL); // create a gun for the actor
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