schteppe / cannon.js

A lightweight 3D physics engine written in JavaScript.
http://schteppe.github.com/cannon.js
MIT License
4.72k stars 711 forks source link

Cannot stack objects without sliding? #348

Closed antu3199 closed 6 years ago

antu3199 commented 7 years ago

It seems to me that whenever I stack a lot of bodies together (to create a breakable wall for example), some blocks slowly start to slide off and eventually break the structure. It even happens for the jenga example in the demoes folder. If I wait long enough, the jenga tower will collapse on its own (though it takes quite a while). If I look close enough, the objects often seem to be vibrating, even for the jenga example, which is causing it to slowly collapse. Is there a parameter that I can adjust to fix this or is it a bug/limitation?

schteppe commented 7 years ago

Unfortunately they will always slide a tiny bit. One solution you could try is the "sleep" feature (see the sleep demo). A slowly moving body will fall asleep, and then it won't move at all until something wakes it up.