From 048872c79ad94952a587092a2095a73db174885a Mon Sep 17 00:00:00 2001 From: David Back Date: Wed, 6 Jun 2018 17:32:52 -0700 Subject: [PATCH 1/3] use messageEquip flag to fix Hifi-Hand-Grab --- .../controllerModules/equipEntity.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/system/controllers/controllerModules/equipEntity.js b/scripts/system/controllers/controllerModules/equipEntity.js index 08b88fe74d..d87f5dc94a 100644 --- a/scripts/system/controllers/controllerModules/equipEntity.js +++ b/scripts/system/controllers/controllerModules/equipEntity.js @@ -274,6 +274,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.equipedWithSecondary = false; this.handHasBeenRightsideUp = false; this.mouseEquip = false; + this.messageEquip = false; this.parameters = makeDispatcherModuleParameters( 300, @@ -283,11 +284,10 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var equipHotspotBuddy = new EquipHotspotBuddy(); - this.setMessageGrabData = function(entityProperties, mouseEquip) { + this.setMessageGrabData = function(entityProperties) { if (entityProperties) { this.messageGrabEntity = true; this.grabEntityProps = entityProperties; - this.mouseEquip = mouseEquip; } }; @@ -585,6 +585,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.messageGrabEntity = false; this.grabEntityProps = null; this.mouseEquip = false; + this.messageEquip = false; }; this.updateInputs = function (controllerData) { @@ -661,7 +662,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var timestamp = Date.now(); this.updateInputs(controllerData); - if (!this.mouseEquip && !this.isTargetIDValid(controllerData)) { + if (!this.mouseEquip && !this.messageEquip && !this.isTargetIDValid(controllerData)) { this.endEquipEntity(); return makeRunningValues(false, [], []); } @@ -762,9 +763,8 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var equipModule = (data.hand === "left") ? leftEquipEntity : rightEquipEntity; var entityProperties = Entities.getEntityProperties(data.entityID, DISPATCHER_PROPERTIES); entityProperties.id = data.entityID; - var mouseEquip = false; - equipModule.setMessageGrabData(entityProperties, mouseEquip); - + equipModule.messageEquip = true; + equipModule.setMessageGrabData(entityProperties); } catch (e) { print("WARNING: equipEntity.js -- error parsing Hifi-Hand-Grab message: " + message); } @@ -812,15 +812,16 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var distanceToLeftHand = Vec3.distance(entityProperties.position, leftHandPosition); var leftHandAvailable = leftEquipEntity.targetEntityID === null; var rightHandAvailable = rightEquipEntity.targetEntityID === null; - var mouseEquip = true; if (rightHandAvailable && (distanceToRightHand < distanceToLeftHand || !leftHandAvailable)) { // clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags) clearGrabActions(entityID); - rightEquipEntity.setMessageGrabData(entityProperties, mouseEquip); + rightEquipEntity.mouseEquip = true; + rightEquipEntity.setMessageGrabData(entityProperties); } else if (leftHandAvailable && (distanceToLeftHand < distanceToRightHand || !rightHandAvailable)) { // clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags) clearGrabActions(entityID); - leftEquipEntity.setMessageGrabData(entityProperties, mouseEquip); + leftEquipEntity.mouseEquip = true; + leftEquipEntity.setMessageGrabData(entityProperties); } } } From 0ee55a09b6dfa3a035162b88b3808e85b8a27fb4 Mon Sep 17 00:00:00 2001 From: David Back Date: Wed, 6 Jun 2018 17:35:25 -0700 Subject: [PATCH 2/3] fix tabs --- .../controllers/controllerModules/equipEntity.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/system/controllers/controllerModules/equipEntity.js b/scripts/system/controllers/controllerModules/equipEntity.js index d87f5dc94a..4e1cf66531 100644 --- a/scripts/system/controllers/controllerModules/equipEntity.js +++ b/scripts/system/controllers/controllerModules/equipEntity.js @@ -274,7 +274,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.equipedWithSecondary = false; this.handHasBeenRightsideUp = false; this.mouseEquip = false; - this.messageEquip = false; + this.messageEquip = false; this.parameters = makeDispatcherModuleParameters( 300, @@ -585,7 +585,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.messageGrabEntity = false; this.grabEntityProps = null; this.mouseEquip = false; - this.messageEquip = false; + this.messageEquip = false; }; this.updateInputs = function (controllerData) { @@ -763,7 +763,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var equipModule = (data.hand === "left") ? leftEquipEntity : rightEquipEntity; var entityProperties = Entities.getEntityProperties(data.entityID, DISPATCHER_PROPERTIES); entityProperties.id = data.entityID; - equipModule.messageEquip = true; + equipModule.messageEquip = true; equipModule.setMessageGrabData(entityProperties); } catch (e) { print("WARNING: equipEntity.js -- error parsing Hifi-Hand-Grab message: " + message); @@ -815,12 +815,12 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa if (rightHandAvailable && (distanceToRightHand < distanceToLeftHand || !leftHandAvailable)) { // clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags) clearGrabActions(entityID); - rightEquipEntity.mouseEquip = true; + rightEquipEntity.mouseEquip = true; rightEquipEntity.setMessageGrabData(entityProperties); } else if (leftHandAvailable && (distanceToLeftHand < distanceToRightHand || !rightHandAvailable)) { // clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags) clearGrabActions(entityID); - leftEquipEntity.mouseEquip = true; + leftEquipEntity.mouseEquip = true; leftEquipEntity.setMessageGrabData(entityProperties); } } From 8f5de7b16a3b8b000b76f5ad8ef79b351a20cb68 Mon Sep 17 00:00:00 2001 From: David Back Date: Wed, 6 Jun 2018 18:05:26 -0700 Subject: [PATCH 3/3] use messageGrabEntity flag instead --- .../controllers/controllerModules/equipEntity.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/scripts/system/controllers/controllerModules/equipEntity.js b/scripts/system/controllers/controllerModules/equipEntity.js index 4e1cf66531..91c8d89daf 100644 --- a/scripts/system/controllers/controllerModules/equipEntity.js +++ b/scripts/system/controllers/controllerModules/equipEntity.js @@ -273,8 +273,6 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.shouldSendStart = false; this.equipedWithSecondary = false; this.handHasBeenRightsideUp = false; - this.mouseEquip = false; - this.messageEquip = false; this.parameters = makeDispatcherModuleParameters( 300, @@ -584,8 +582,6 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.targetEntityID = null; this.messageGrabEntity = false; this.grabEntityProps = null; - this.mouseEquip = false; - this.messageEquip = false; }; this.updateInputs = function (controllerData) { @@ -631,14 +627,12 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa // if the potentialHotspot is cloneable, clone it and return it // if the potentialHotspot os not cloneable and locked return null - if (potentialEquipHotspot && (((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) || this.messageGrabEntity)) { this.grabbedHotspot = potentialEquipHotspot; this.targetEntityID = this.grabbedHotspot.entityID; this.startEquipEntity(controllerData); - this.messageGrabEntity = false; this.equipedWithSecondary = this.secondarySmoothedSqueezed(); return makeRunningValues(true, [potentialEquipHotspot.entityID], []); } else { @@ -662,7 +656,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var timestamp = Date.now(); this.updateInputs(controllerData); - if (!this.mouseEquip && !this.messageEquip && !this.isTargetIDValid(controllerData)) { + if (!this.messageGrabEntity && !this.isTargetIDValid(controllerData)) { this.endEquipEntity(); return makeRunningValues(false, [], []); } @@ -763,7 +757,6 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var equipModule = (data.hand === "left") ? leftEquipEntity : rightEquipEntity; var entityProperties = Entities.getEntityProperties(data.entityID, DISPATCHER_PROPERTIES); entityProperties.id = data.entityID; - equipModule.messageEquip = true; equipModule.setMessageGrabData(entityProperties); } catch (e) { print("WARNING: equipEntity.js -- error parsing Hifi-Hand-Grab message: " + message); @@ -815,12 +808,10 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa if (rightHandAvailable && (distanceToRightHand < distanceToLeftHand || !leftHandAvailable)) { // clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags) clearGrabActions(entityID); - rightEquipEntity.mouseEquip = true; rightEquipEntity.setMessageGrabData(entityProperties); } else if (leftHandAvailable && (distanceToLeftHand < distanceToRightHand || !rightHandAvailable)) { // clear any existing grab actions on the entity now (their later removal could affect bootstrapping flags) clearGrabActions(entityID); - leftEquipEntity.mouseEquip = true; leftEquipEntity.setMessageGrabData(entityProperties); } }