diff --git a/src/core/systems/ClientControls.js b/src/core/systems/ClientControls.js index 07a9d9629..ffbe67f63 100644 --- a/src/core/systems/ClientControls.js +++ b/src/core/systems/ClientControls.js @@ -85,6 +85,9 @@ export class ClientControls extends System { delta: 0, } this.xrSession = null + + this.pointerInteractionOccurred = false + document.addEventListener('pointerdown', () => this.pointerInteractionOccurred = true, { once: true }) } start() { @@ -549,6 +552,15 @@ export class ClientControls extends System { } } + onInitialPointerInteraction(callback) { + if (this.pointerInteractionOccurred) { + callback.call() + + } else { + document.addEventListener('pointerdown', callback, { once: true }) + } + } + onKeyDown = e => { if (e.defaultPrevented) return if (e.repeat) return