Search code examples
aframe

Aframe Entity disappear after device rotation


I created a button to make some entities visible or not by clicking this button. But if I rotate the phone right after clicking the button, the entities become visible for a few seconds and then suddenly disappear. If I keep the position of the phone after the button is pressed, the items are displayed correctly. How to fix this bug? Glitch code, a short video with the proof


Solution

  • The entity is disappearing (or appearing out of nowhere) because the cursor emits two click events:

    • one from the actual touch
    • the second one because of fusing. The cursor waits for fuseTimeoutms (1500 by default) and emits a click.

    Once you disable fusing, all should work as expected

    cursor="rayOrigin: mouse; fuse: false"