Reputation: 1598
How should I set a single callback which would trigger when there is no motion in the Space of Nape, when each body "goes to sleep"? I couldn't find any proper solution for this, but I guess this is a must-have for a physics engine. Thank you.
Upvotes: 1
Views: 162
Reputation: 3738
You could check space.liveBodies.length
on tick (wherever you're calling space.step()
).
When it reaches 0
, then all bodies are sleeping.
Upvotes: 2