Check if an object has stopped moving

Hi, is there a way to check if an object has stppped moving.

I am playing around with the simplepool project and the thing I want to do is that when I have shot a ball and it stops I want to reset the x and y values to the original.
Maholm [import]uid: 5717 topic_id: 3217 reply_id: 303217[/import]

Hey Maholm,

I think you can accomplish this by adding a Runtime Listener to the object in motion. At each game cycle increment, it will check a certain function, in this case some function you create like “CheckVelocity”. Within that function, use “body:getLinearVelocity()” which will return an X and Y value for velocity. If they are both sufficiently low (near 0, but not necessarily at 0), that would indicate the object has stopped moving.

http://developer.anscamobile.com/reference/index/bodygetlinearvelocity

If anybody else has a solution, please post! I’m sure this issue/need will come up in one of my games eventually…

Brent
[import]uid: 9747 topic_id: 3217 reply_id: 9511[/import]