From 2cc1fac9c999dbfdb8c6a83c1d3b3ece1cc47c48 Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Thu, 20 Sep 2018 18:05:32 -0700 Subject: [PATCH] toggle controller raycaster only in VR --- src/components/debug-controller.js | 3 +++ src/index.html | 4 ++-- src/state/index.js | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/debug-controller.js b/src/components/debug-controller.js index 414621f..09d908e 100644 --- a/src/components/debug-controller.js +++ b/src/components/debug-controller.js @@ -30,6 +30,9 @@ AFRAME.registerComponent('debug-controller', { secondaryHand.setAttribute('controller', 'controllerType', 'vive-controls'); } + // Enable raycaster. + this.el.emit('enter-vr', null, false); + document.addEventListener('keydown', evt => { var primaryPosition; var primaryRotation; diff --git a/src/index.html b/src/index.html index e73f154..646e576 100644 --- a/src/index.html +++ b/src/index.html @@ -63,9 +63,9 @@ {% macro saber (hand, otherHand, color) %} { } + computeState: (state) => { + state.leftRaycasterActive = state.menu.active && state.activeHand === 'left' && + state.inVR; + state.rightRaycasterActive = state.menu.active && state.activeHand === 'right' && + state.inVR; + } }); function computeSearchPagination (state) {