diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 1eaed44ce2..8f18be9c27 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -14,7 +14,7 @@ TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic, getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Picks, makeLaserLockInfo, makeLaserParams, AddressManager, getEntityParents, Selection, DISPATCHER_HOVERING_LIST, - worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES, Uuid, Picks + worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES, Uuid, Picks, handsAreTracked, Messages */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); @@ -374,6 +374,9 @@ Script.include("/~/system/libraries/controllers.js"); this.isReady = function (controllerData) { if (HMD.active) { + if (handsAreTracked()) { + return makeRunningValues(false, [], []); + } if (this.notPointingAtEntity(controllerData)) { return makeRunningValues(false, [], []); } diff --git a/scripts/system/controllers/controllerModules/farGrabEntity.js b/scripts/system/controllers/controllerModules/farGrabEntity.js index ecafa3cb26..c486d46c33 100644 --- a/scripts/system/controllers/controllerModules/farGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farGrabEntity.js @@ -12,7 +12,7 @@ HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, projectOntoEntityXYPlane, ContextOverlay, HMD, Picks, makeLaserLockInfo, makeLaserParams, AddressManager, getEntityParents, Selection, DISPATCHER_HOVERING_LIST, unhighlightTargetEntity, Messages, findGrabbableGroupParent, - worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES + worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES, handsAreTracked */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); @@ -63,7 +63,6 @@ Script.include("/~/system/libraries/controllers.js"); this.endedGrab = 0; this.MIN_HAPTIC_PULSE_INTERVAL = 500; // ms this.disabled = false; - var _this = this; this.initialControllerRotation = Quat.IDENTITY; this.currentControllerRotation = Quat.IDENTITY; this.manipulating = false; @@ -99,7 +98,7 @@ Script.include("/~/system/libraries/controllers.js"); this.getOffhand = function () { return (this.hand === RIGHT_HAND ? LEFT_HAND : RIGHT_HAND); - } + }; // Activation criteria for rotating a fargrabbed entity. If we're changing the mapping, this is where to do it. this.shouldManipulateTarget = function (controllerData) { @@ -406,6 +405,9 @@ Script.include("/~/system/libraries/controllers.js"); this.isReady = function (controllerData) { if (HMD.active) { + if (handsAreTracked()) { + return makeRunningValues(false, [], []); + } if (this.notPointingAtEntity(controllerData)) { return makeRunningValues(false, [], []); } diff --git a/scripts/system/controllers/controllerModules/farTrigger.js b/scripts/system/controllers/controllerModules/farTrigger.js index c9c9d3deee..2a8a4d7246 100644 --- a/scripts/system/controllers/controllerModules/farTrigger.js +++ b/scripts/system/controllers/controllerModules/farTrigger.js @@ -8,7 +8,7 @@ /* global Script, RIGHT_HAND, LEFT_HAND, MyAvatar, makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters, - getGrabbableData, makeLaserParams, DISPATCHER_PROPERTIES + getGrabbableData, makeLaserParams, DISPATCHER_PROPERTIES, RayPick, handsAreTracked */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); @@ -63,6 +63,9 @@ Script.include("/~/system/libraries/controllers.js"); this.isReady = function (controllerData) { this.targetEntityID = null; + if (handsAreTracked()) { + return makeRunningValues(false, [], []); + } if (controllerData.triggerClicks[this.hand] === 0) { return makeRunningValues(false, [], []); } diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index 3b81e17473..fc2306fe28 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -63,7 +63,8 @@ clearHighlightedEntities:true, unhighlightTargetEntity:true, distanceBetweenEntityLocalPositionAndBoundingBox: true, - worldPositionToRegistrationFrameMatrix: true + worldPositionToRegistrationFrameMatrix: true, + handsAreTracked: true */ MSECS_PER_SEC = 1000.0; @@ -600,6 +601,10 @@ worldPositionToRegistrationFrameMatrix = function(wptrProps, pos) { return offsetMat; }; +handsAreTracked = function () { + return Controller.getPoseValue(Controller.Standard.LeftHandIndex3).valid || + Controller.getPoseValue(Controller.Standard.RightHandIndex3).valid; +} if (typeof module !== 'undefined') { module.exports = { @@ -624,6 +629,7 @@ if (typeof module !== 'undefined') { TRIGGER_OFF_VALUE: TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE: TRIGGER_ON_VALUE, DISPATCHER_HOVERING_LIST: DISPATCHER_HOVERING_LIST, - worldPositionToRegistrationFrameMatrix: worldPositionToRegistrationFrameMatrix + worldPositionToRegistrationFrameMatrix: worldPositionToRegistrationFrameMatrix, + handsAreTracked: handsAreTracked }; } diff --git a/scripts/system/miniTablet.js b/scripts/system/miniTablet.js index bc9bcfe36d..1650cb60f4 100644 --- a/scripts/system/miniTablet.js +++ b/scripts/system/miniTablet.js @@ -8,7 +8,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/* global getTabletWidthFromSettings, TRIGGER_OFF_VALUE, Controller, Script, Camera, Tablet, MyAvatar, +/* global getTabletWidthFromSettings, handsAreTracked, TRIGGER_OFF_VALUE, Controller, Script, Camera, Tablet, MyAvatar, Quat, SoundCache, HMD, Overlays, Vec3, Uuid, Messages */ (function () { @@ -81,11 +81,6 @@ return hand === LEFT_HAND ? RIGHT_HAND : LEFT_HAND; } - function handsAreTracked() { - return Controller.getPoseValue(Controller.Standard.LeftHandIndex3).valid || - Controller.getPoseValue(Controller.Standard.RightHandIndex3).valid; - } - UI = function () { if (!(this instanceof UI)) {