lundi 26 décembre 2016

Matter. js objects stop moving

I am using matter. js to create a 2d scene. I apply a force on an object in the scene, this object hits other objects but eventually all objects/bodies stop moving due to friction and loss of energy.

Somehow I need to detect when all bodies in the scene have stopped moving. I am finding difficulty doing so since after going through the documentation I did not find a built in method to do the check for me. Also I tried iterating througb the bodies in the scene and checking some attributes I thought would determine if the object was moving or still, this got me nowhere.

Does anyone know of a clean way to check if all bodies in the scene are not moving anymore?




Aucun commentaire:

Enregistrer un commentaire