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.
You could check space.liveBodies.length
on tick (wherever you're calling space.step()
).
When it reaches 0
, then all bodies are sleeping.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.