Object falling in physics

Hi, how should I deter if an object is falling in my physics? Should I use getVelocity or similar?

One other question, is it possible to add an event when the object is NOT having a collision?

Best regards, Joakim [import]uid: 81188 topic_id: 20814 reply_id: 320814[/import]

Hi jkrassman,

Well if your app just has acceleration in the y-direction, you can just say:

v\_x, v\_y = body:getLinearVelocity(); -- To acquire velocity components in the x and y directions.  
if(v\_y == 0) then -- Object isn't falling to the ground.  
-- Execute code.  
end  

So yes, you can just use getVelocity.

As for your second question, one workaround would be to use status flags. For example, in your collision code you could say.

function onCollision(self, event)  
event\_running = false;  
-- Run some other code.  
-- Just before collision stops, allow event to occur.  
event\_running = true;  
end  

And then in your normal event, say it’s a touch event you can say

function event\_not\_during\_collision:touch(event) if(event\_running ~= false) -- Execute code end end [import]uid: 116225 topic_id: 20814 reply_id: 82099[/import]