I have a falling object. I need an event that fires when the object lands on another object and comes to rest.
While we're on the subject of physics, how to detect when a body is outside the bounds of the screen? Is this best approached just checking x and y?
If it can go off the screen any direction then checking x and y is good. (Multipuck has an example.)
If it can only fall through the bottom of the screen (for example) then a collision platform off the screen is useful.
Set up a collision listener in the normal way but use obj:getLinearImpulse() to detect if movement has ceased, is my advice.
If you aren't familiar with collision listeners please refer to Corona For Newbies Part 4, available on Techority.
Peach :)
Thanks for the reply. I tried obj:getLinearImpulse() but get:
attempt to call method 'getLinearImpulse' (a nil value)
I tried getLinearVelocity() which returns 0 until the object hits another object then it returns a number. I would expect this to return a value representing the speed. All in all neither of these seems to work for me.
Using a collision seems over kill. All I need to know is when the object stops moving.
Oops my bad. I just realized I was only getting the vx not the vy value from getLinearVelocity(). Now I'm getting a useful number showing the object moving down.
Sorry! That was my bad, I meant obj:getLinearVelocity().
Shouldn't read the forum in the middle of the night, I guess ;)
Glad you got it sorted.