Help me put with a physics problem

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? [import]uid: 98652 topic_id: 19727 reply_id: 319727[/import]

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 :slight_smile: [import]uid: 52491 topic_id: 19727 reply_id: 76373[/import]

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. [import]uid: 98652 topic_id: 19727 reply_id: 76501[/import]

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. [import]uid: 98652 topic_id: 19727 reply_id: 76502[/import]

Sorry! That was my bad, I meant obj:getLinearVelocity().

Shouldn’t read the forum in the middle of the night, I guess :wink:

Glad you got it sorted. [import]uid: 52491 topic_id: 19727 reply_id: 76547[/import]