Quote:
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.



First like i did in my code and txesmi is telling add ent_bonerest inside the while() loop.

Next you first try you passed a pointer into the tilt value of the ent_bonerotate( .....vector(0,player,0)...) God knows what the value of the pointer was

Next in the second - This one should not crash - ent_bonerotate(my,"waist", vector(0, player.tilt, 0));
However it shouldn't work the way you want.

It may be that if the last to are failing the the pointer "player" is not assigned. Crashing makes no sense - these just should not work the way you want.