Game Development Community

Bouncing projectiles

by Very Interactive Person · in Torque Game Engine · 08/16/2004 (7:33 am) · 2 replies

I'm playing around with bouncing projectiles (with an arming delay), and they work fine, no problems, but I want them to stop tumbling when they are on their not moving any more. I tried the numBounces, and snapOnMaxBounce in the datablock, but that doesn't do anything. I mean now they bounce around and eventually lay still at some spot, but they keep on "rolling" and "shaking" even tough they're not moving. How can I stop this from happening?

#1
08/16/2004 (10:09 am)
My advice would be to look in the update code for the projectiles (processTick?) and do something like this... you could check the velocity length, and if it's not over something like 0.1, you can assume it's stopped (you'll have to tweak the value).
You could also save the previous position each tick, or every few ticks, whatever. When you process the data for the new position, compare the old with the new, and if the data hasn't changed enough, tell it to stop.
To stop, there may already be functionality for that, but if not...
add a mStopped variable or something like that, set it when necessary, and before moving the object, check to see whether or not it's stopped. i.e. if(!mStopped) { moveMyObject(); }

There may also be something simpler in script/datablock settings, but I'm not familiar with them.
#2
08/17/2004 (1:32 am)
The engine code does not support what you want. belive me, i looked into it a long time ago. They are bouncing when it looks like they are stopped.

-s