I am trying to make it so that an enemy will bend at the waist as needed, to always have its upper body facing the player.

So for example, if the player is walking up stairs, and the enemy attacks the player from up the stairs, the enemy should bend forward at the waist so that its upper body is facing down directly toward the player.

I am assuming that ent_bonerotate() would be used for this? I am trying to make this happen, but so far it is not working. This is the code I have so far:

Code:
action monster_code()
{
   ...

   ent_bonereset(my,"waist");

   ...

   while(1)
   {
      ...

      limit=clamp(camera.tilt,-53,53); //min max
      ent_bonerotate(my, "waist", vector(0,limit,0));

      wait(1);
   }
}



I am assuming that I have to somehow manipulate the ent_bonerotate() function to make it so the enemy is bending at the waist, where its upper body is continually facing the player at all times while attacking.

Does anyone have a clue on how I could start on doing this?

Last edited by Ruben; 10/24/15 11:38.