How to detect if a mesh has stopped moving

I have a school homework to create a simple bowling game. After applying force to the bowling ball, I want to detect if the game is over (if the bowling ball has stopped moving or fell off the ground) then I can show the score and “play again” button, but I’m not sure how to detect if the ball has stopped moving. Is there any BABYLON function that can do this?

Do you plan on using a physics engine?

If so, getLinearVelocity() could let you know when something stops moving

References:
https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep
https://www.babylonjs-playground.com/#DU4FPJ#3

Hello,
In combination with the @gbz’s proposal, if you don’t necessary need to wait for the ball to stop, you can add a hidden mesh (behind the bowling pins) on which you configure an “intersection enter” trigger, like this :
https://www.babylonjs-playground.com/#BEFOO#787

1 Like