chandlerprall / Physijs

Physics plugin for Three.js
MIT License
2.77k stars 455 forks source link

Detect when object completely idle #243

Closed eddyuk closed 8 years ago

eddyuk commented 9 years ago

I am looking for a way (maybe there is a event) that will rise when object completely stopped moving. What I mean is, if I have a falling box that will bounce few times of surface and rotate in process, I want to know when it completely stopped. Thanks in advanced

ghost commented 8 years ago

@eddyuk in physics engines there should (usually) be something called 'object sleeping', where the physics object is disabled for solving because it is not moving, thus no updates to be made on it. This feature could be replicated (because I don't think an event exists for it yet) by checking if the velocity of the object is lower than a limit (like 0.001). If it is, do whatever you need to do...

eddyuk commented 8 years ago

Thanks! I asked that question on Stack Exchange and was given a following working answer (I think its exactly what you mean)