toggle controller raycaster only in VR
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
{% macro saber (hand, otherHand, color) %}
|
||||
<a-entity id="{{ hand }}Hand"
|
||||
mixin="raycaster"
|
||||
bind__hand-swapper="enabled: menu.active && activeHand === '{{ otherHand }}'"
|
||||
bind__hand-swapper="enabled: {{ otherHand }}RaycasterActive"
|
||||
bind__pauser="enabled: !menu.active"
|
||||
bind__raycaster="enabled: menu.active && activeHand === '{{ hand }}'; showLine: menu.active && activeHand === '{{ hand }}'"
|
||||
bind__raycaster="enabled: {{ hand }}RaycasterActive; showLine: {{ hand }}RaycasterActive"
|
||||
bind__saber-controls="bladeEnabled: !menu.active"
|
||||
cursor
|
||||
saber-controls="hand: {{ hand }}"
|
||||
|
||||
@@ -164,7 +164,12 @@ AFRAME.registerState({
|
||||
/**
|
||||
* Post-process the state after each action.
|
||||
*/
|
||||
// computeState: (state) => { }
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user