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. You have to detect the event (maybe there’s a better way, haven’t done this in Babylon)

  2. Then you can the action, or just toggle a flag “do not play the animation”