How do I stop a registerBeforeRender action via a key

I want to register an action like, when user press ‘space’ key this animation ( or this action before rendering) will be disposed. How can I do that

1 Like
  1. You have https://doc.babylonjs.com/api/classes/babylon.scene#onkeyboardobservable to detect the event (maybe there’s a better way, haven’t done this in Babylon)

  2. Then you can https://doc.babylonjs.com/api/classes/babylon.scene#unregisterbeforerender the action, or just toggle a flag “do not play the animation”

2 Likes