Search code examples
javascripttriggersdom-eventsaframe

Disable all triggers during an event in aframe


I have a bunch of triggers on my scene that I need to disable while an audio file is playing.

So the audio file is the first thing playing when opening the scene. During this time I want all the triggers disable so that the user cannot interact with them during the audio time.

Is there a way to disable all of them?


Solution

  • A-Frame master build has raycaster.enabled property. So you can setAttribute('raycaster', 'enabled', false) temporarily.

    https://github.com/aframevr/aframe/commit/3ea1b0c32070975b6a8cf5e59d345ac789b930fe

    You can also run .pause() on components if they implement that handler correctly. If you want to disable triggerdown on vive-controls for example:

    controllerEl.components['vive-controls'].pause();