diff --git a/scripts/system/controllers/controllerModules/equipEntity.js b/scripts/system/controllers/controllerModules/equipEntity.js index 29db02c6de..4978f225ce 100644 --- a/scripts/system/controllers/controllerModules/equipEntity.js +++ b/scripts/system/controllers/controllerModules/equipEntity.js @@ -255,6 +255,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.messageGrabEntity = false; this.grabEntityProps = null; this.shouldSendStart = false; + this.equipedWithSecondary = false; this.parameters = makeDispatcherModuleParameters( 300, @@ -370,6 +371,10 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa return this.rawSecondaryValue < BUMPER_ON_VALUE; }; + this.secondarySmoothedSqueezed = function() { + return this.rawSecondaryValue > BUMPER_ON_VALUE; + }; + this.chooseNearEquipHotspots = function(candidateEntityProps, controllerData) { var _this = this; var collectedHotspots = flatten(candidateEntityProps.map(function(props) { @@ -592,11 +597,13 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa // if the potentialHotspot os not cloneable and locked return null if (potentialEquipHotspot && - ((this.triggerSmoothedSqueezed() && !this.waitForTriggerRelease) || this.messageGrabEntity)) { + (((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) || + this.messageGrabEntity)) { this.grabbedHotspot = potentialEquipHotspot; this.targetEntityID = this.grabbedHotspot.entityID; this.startEquipEntity(controllerData); this.messageGrabEnity = false; + this.equipedWithSecondary = this.secondarySmoothedSqueezed(); return makeRunningValues(true, [potentialEquipHotspot.entityID], []); } else { return makeRunningValues(false, [], []); @@ -627,7 +634,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa return this.checkNearbyHotspots(controllerData, deltaTime, timestamp); } - if (controllerData.secondaryValues[this.hand]) { + if (controllerData.secondaryValues[this.hand] && !this.equipedWithSecondary) { // this.secondaryReleased() will always be true when not depressed // so we cannot simply rely on that for release - ensure that the // trigger was first "prepared" by being pushed in before the release @@ -644,7 +651,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var dropDetected = this.dropGestureProcess(deltaTime); - if (this.triggerSmoothedReleased()) { + if (this.triggerSmoothedReleased() || this.secondaryReleased()) { if (this.shouldSendStart) { // we don't want to send startEquip message until the trigger is released. otherwise, // guns etc will fire right as they are equipped. @@ -653,6 +660,9 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.shouldSendStart = false; } this.waitForTriggerRelease = false; + if (this.secondaryReleased() && this.equipedWithSecondary) { + this.equipedWithSecondary = false; + } } if (dropDetected && this.prevDropDetected !== dropDetected) { diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 5c31c859e9..c5b82f75f0 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -132,7 +132,7 @@ Script.include("/~/system/libraries/controllers.js"); this.updateLaserPointer = function(controllerData) { var SEARCH_SPHERE_SIZE = 0.011; var MIN_SPHERE_SIZE = 0.0005; - var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE); + var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE) * MyAvatar.sensorToWorldScale; var dim = {x: radius, y: radius, z: radius}; var mode = "hold"; if (!this.distanceHolding && !this.distanceRotating) { @@ -424,7 +424,7 @@ Script.include("/~/system/libraries/controllers.js"); this.laserPointerOff(); return makeRunningValues(false, [], []); } - + this.intersectionDistance = controllerData.rayPicks[this.hand].distance; this.updateLaserPointer(controllerData); var otherModuleName =this.hand === RIGHT_HAND ? "LeftFarActionGrabEntity" : "RightFarActionGrabEntity"; diff --git a/scripts/system/controllers/controllerModules/tabletStylusInput.js b/scripts/system/controllers/controllerModules/tabletStylusInput.js index def958b223..36ed7920dd 100644 --- a/scripts/system/controllers/controllerModules/tabletStylusInput.js +++ b/scripts/system/controllers/controllerModules/tabletStylusInput.js @@ -335,7 +335,7 @@ Script.include("/~/system/libraries/controllers.js"); var SCALED_TABLET_MAX_HOVER_DISTANCE = TABLET_MAX_HOVER_DISTANCE * sensorScaleFactor; if (nearestStylusTarget && nearestStylusTarget.distance > SCALED_TABLET_MIN_TOUCH_DISTANCE && - nearestStylusTarget.distance < SCALED_TABLET_MAX_HOVER_DISTANCE) { + nearestStylusTarget.distance < SCALED_TABLET_MAX_HOVER_DISTANCE && !this.getOtherHandController().stylusTouchingTarget) { this.requestTouchFocus(nearestStylusTarget);