Game Development Community

Ball rolling animation problem

by Nancy Lee · in Artist Corner · 08/23/2008 (4:32 am) · 1 replies

I was trying to create a bubble with rolling animation. I set it as playerData. but when I put it into torque, and call the playThread() function, it rolls one round, then goes back to the original position and rolls again.

is there anything I should do to make it continue on its path, not rolls back and forward. should I set it as non cyclic?
or do you know any tutorials related to this problem?

Thanks so much.

#1
08/23/2008 (2:55 pm)
So you are trying to use a bubble shape as the player? That should work ok, but you need to do a couple of things to get it working right:

1) You'll certainly want to make the animation cyclic, and should call it 'run' so that you can use the existing player code to trigger the right animations when you move the bubble.

2) As part of (1) above, you need to generate ground transforms for the player code to work with your animation correctly. Ground transforms just tell the Torque engine how far your bubble will move along the ground during the roll ('run') animation. This prevents player shapes looking like they are sliding along the ground when they move by matching the animated movement to the actual movement in-game. Normally it is used for walking/running type animations, but I think it makes sense for your rolling animation too.

To generate ground transforms, just create a box called 'bounds' that encloses your bubble shape in milkshape. Then when you animate the bubble rolling along, make sure to animate the box moving along with it (the box should not roll, just slide along with the bubble).

Make sure to disable the 'Ignore ground transform' flag in the Edit Sequence dialog for the roll animation.

3) If you set it up correctly as a playerData, you should be able to move the bubble around with wsad keys and Torque will play your rolling animation automagically!