Originally Posted By: txesmi
Hi,
reading 23rd workshop would take you some doubts off.

Originally Posted By: Online Tutorial - Workshop 23: Bones
Why do we need to reset the bone first? Let's assume that bone_angle.pan is set to 30 degrees at a certain moment. Then, let's imagine that the player moves the mouse a little further in the following frame, until bone_angle.pan reaches 35 degrees. But the gun was already rotated by 30 degrees in the previous frame, so it would now rotate another 35 degrees, setting the pan angle to 30 + 35 = 65 degrees!

This is what would happen if we wouldn't use that "ent_bonereset" instruction inside the while loop. By using ent_bonereset we discard the old angles every frame, so the bone will only get the newly computed angles (pan = 35 degrees in my previous example)


Salud!


I tried incorporating this code:

Code:
action monster_code()
{
   ...

   ent_bonereset(my,"waist");

   ...

   while(1)
   {
      ...

      ent_bonerotate(my, "waist", vector(0, player, 0));

      wait(1);
   }
}



The monster charges toward me using the above code. It seems to be bending the monster's waist. However, the monster's waist is bent all the way back when charging the player, when the monster should bend a little forward to face its upper body toward the player and strike the player, since the monster is taller than the player.

I tried changing this line in the above code:

Code:
ent_bonerotate(my, "waist", vector(0, player, 0));



to:

Code:
ent_bonerotate(my, "waist", vector(0, player.tilt, 0));



or

Code:
ent_bonerotate(my, "waist", vector(0, player.y, 0));



When I do either of these two options, the monster_code() action crashes when I run the game. It does not crash when I use the original code.

Last edited by Ruben; 10/25/15 06:01.