Weird animation behavior
by Radoslaw Marcin Kurczewski · in Torque Game Engine · 05/20/2003 (4:03 am) · 2 replies
I've created animal (camel) bot, based on AIPlayer class. It's supposed to wander through the level using randomly selected target points (in some given distance from starting point).
The problem is, that after some time the animation starts jerking - it looks like camel continuously trying to turn left and right by small angle. After some time it stops, then starts again :-(
Our animator checked the model and it seems to be ok...
Does anyone have suggestion, what could it be?
Roman
The problem is, that after some time the animation starts jerking - it looks like camel continuously trying to turn left and right by small angle. After some time it stops, then starts again :-(
Our animator checked the model and it seems to be ok...
Does anyone have suggestion, what could it be?
Roman
#2
I made many tests since last post:
1. I know that the reason of jerking is that pickActionAnimation() from player.cc chooses Root animation instead of Run - dot product of current velocity vector and run direction (0,1,0) is less than zero.
2. Such a situation happens only in particular range of angles - if my camel is rotated about 180 degree, pickActionAnimation() decides to set Back animation (I have no one so it chooses Root instead).
3. As I observed, the camel is rotating around its center, but outside bounding box doesn't change direction so even if camel is going forward, its bounding box is moving back.
4. I thought that bug is in rotation methods, but for player character it works fine - as a human player I also rotate around my center without changing bounding box direction and animation looks good.
5. Finally I prepared simple path for AIPlayers in clear Torque demo version, with standard AI Player and standard human players as a model. And I had NO jerking. Then I replaced the model with my camel but without changing data blocks - I had NO jerking again.
6. During this test I noticed that my camel is moving really fast (because of datablock settings for human player), so I decided to decrease this speed to 0.1 of orginal one. And I've got jerking again! I put again human model but with 0.1 of original speed and I observed exactly the same effect.
Conclusion: smaller speed and particular rotation angles cause wrong result of dot product in pickActionAnimation() (and jerking...), but I still have no idea how to fix it.
Please, give me some advice...
Best regards
Ania
06/09/2003 (3:44 am)
Hi again, I made many tests since last post:
1. I know that the reason of jerking is that pickActionAnimation() from player.cc chooses Root animation instead of Run - dot product of current velocity vector and run direction (0,1,0) is less than zero.
2. Such a situation happens only in particular range of angles - if my camel is rotated about 180 degree, pickActionAnimation() decides to set Back animation (I have no one so it chooses Root instead).
3. As I observed, the camel is rotating around its center, but outside bounding box doesn't change direction so even if camel is going forward, its bounding box is moving back.
4. I thought that bug is in rotation methods, but for player character it works fine - as a human player I also rotate around my center without changing bounding box direction and animation looks good.
5. Finally I prepared simple path for AIPlayers in clear Torque demo version, with standard AI Player and standard human players as a model. And I had NO jerking. Then I replaced the model with my camel but without changing data blocks - I had NO jerking again.
6. During this test I noticed that my camel is moving really fast (because of datablock settings for human player), so I decided to decrease this speed to 0.1 of orginal one. And I've got jerking again! I put again human model but with 0.1 of original speed and I observed exactly the same effect.
Conclusion: smaller speed and particular rotation angles cause wrong result of dot product in pickActionAnimation() (and jerking...), but I still have no idea how to fix it.
Please, give me some advice...
Best regards
Ania
Torque Owner Josh Albrecht
I would just add some Con::printf commands to the various player animation funcitons so you can watch what is going on in the console, and keep outputting the aimlocation as well.