How to detect whether an Object came to sleep at a specific position?

Posted by Nils Riedemann on Game Development See other posts from Game Development or by Nils Riedemann
Published on 2012-11-28T18:13:41Z Indexed on 2012/11/28 23:16 UTC
Read the original article Hit count: 258

Filed under:
|

I'm currently writing a small game with box2dweb and I need some direction for this: I'm throwing a Box and have to hit a specific place and trigger an event when the object that's been thrown isn't moving anymore, "fell asleep" so to say.

What's the proper way / best practice for this?

I'm currently thinking of asking the b2World whether an Object is within a specific AABB and then wait a few seconds, check if it's still there and then trigger the event. But this seems to me like the roundabout way and the object might still be moving inside of that AABB and eventually even drop out of the AABB.

© Game Development or respective owner

Related posts about JavaScript

Related posts about box2d