1

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.

momijigari
  • 1,598
  • 2
  • 14
  • 28

1 Answers1

2

You could check space.liveBodies.length on tick (wherever you're calling space.step()).

When it reaches 0, then all bodies are sleeping.

Marcela
  • 3,728
  • 1
  • 15
  • 21