/**
* First of get the euler angles we start from!
**/
ANGLE* StartAngle = nullvector;
ang_for_bone(StartAngle, player, "BoneName");
/**
* Alright now get the euler angles of the destination.
**/
VECTOR* DestVec = vector(you.x, you.y, you.z);
ANGLE* DestAngle = nullvector;
vec_to_ang(DestAngle, DestVec);
/**
* Calculate the difference of the start and destination position.
**/
ANGLE* DiffAngle = nullvector;
ang_diff(DiffAngle, StartAngle, DestAngle);
/**
* Now we have everything we need! Rotate the bone.
**/
ANGLE* StillToRotate = nullvector;
while(1) {
ent_bonerotate(player, "BoneName", vector(
DiffAngle.pan * time_step,
DiffAngle.tilt * time_step,
DiffAngle.roll * time_step)
);
/**
* We gotta check if we are close to our destination.
**/
/**
* For that we first get the angle we still have to journey
**/
ang_for_bone(StartAngle, player, "BoneName");
ang_diff(StillToRotate, StartAngle, DestAngle);
/**
* Now we see if we are near the destination.
**/
if( StillToRotate.pan < 1.0 && StillToRotate.pan > -1.0 &&
StillToRotate.tilt < 1.0 && StillToRotate.tilt > -1.0 &&
StillToRotate.roll < 1.0 && StillToRotate.roll > -1.0) {
/**
* We are pretty close to our destination! Though to make sure
* we really reach the destination just snap the bone to it.
**/
<Your Bone snap code>
// Don't forget to exit the while-loop!
break;
}
wait(1);
}
/**
* (Hopefully) be happy
**/