History

switching near grab priority to be before web surface laser

Wayne Chen committed 8 years ago

Commit eb7bde11 parent f444d0a8 files · +36 −10Browse files

Showing the changes to scripts/system/controllers/controllerModules (8 of 8 files). Show all

Unified · Split

8 files
  1. scripts/system/controllers/controllerModules/highlightNearbyEntities.js +1 −1
  2. scripts/system/controllers/controllerModules/inEditMode.js +1 −1
  3. scripts/system/controllers/controllerModules/inVREditMode.js +1 −1
  4. scripts/system/controllers/controllerModules/nearActionGrabEntity.js +1 −1
  5. scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js +1 −1
  6. scripts/system/controllers/controllerModules/nearParentGrabEntity.js +1 −1
  7. scripts/system/controllers/controllerModules/nearTrigger.js +1 −1
  8. scripts/system/controllers/controllerModules/webSurfaceLaserInput.js +29 −3
scripts/system/controllers/controllerModules/highlightNearbyEntities.js+1−1
@@ -37,7 +37,7 @@ · 36 unmodified lines
37 this.highlightedEntities = [];37 this.highlightedEntities = [];
38 38
39 this.parameters = dispatcherUtils.makeDispatcherModuleParameters(39 this.parameters = dispatcherUtils.makeDispatcherModuleParameters(
40 480,40 120,
41 this.hand === dispatcherUtils.RIGHT_HAND ? ["rightHand"] : ["leftHand"],41 this.hand === dispatcherUtils.RIGHT_HAND ? ["rightHand"] : ["leftHand"],
42 [],42 [],
43 100);43 100);
scripts/system/controllers/controllerModules/inEditMode.js+1−1
@@ -30,7 +30,7 @@ Script.include("/~/system/libraries/utils.js"); · 29 unmodified lines
30 this.reticleMaxY;30 this.reticleMaxY;
31 31
32 this.parameters = makeDispatcherModuleParameters(32 this.parameters = makeDispatcherModuleParameters(
33 160,33 200,
34 this.hand === RIGHT_HAND ? ["rightHand", "rightHandEquip", "rightHandTrigger"] : ["leftHand", "leftHandEquip", "leftHandTrigger"],34 this.hand === RIGHT_HAND ? ["rightHand", "rightHandEquip", "rightHandTrigger"] : ["leftHand", "leftHandEquip", "leftHandTrigger"],
35 [],35 [],
36 100,36 100,
scripts/system/controllers/controllerModules/inVREditMode.js+1−1
@@ -21,7 +21,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); · 20 unmodified lines
21 this.disableModules = false;21 this.disableModules = false;
22 var NO_HAND_LASER = -1; // Invalid hand parameter so that default laser is not displayed.22 var NO_HAND_LASER = -1; // Invalid hand parameter so that default laser is not displayed.
23 this.parameters = makeDispatcherModuleParameters(23 this.parameters = makeDispatcherModuleParameters(
24 200, // Not too high otherwise the tablet laser doesn't work.24 240, // Not too high otherwise the tablet laser doesn't work.
25 this.hand === RIGHT_HAND25 this.hand === RIGHT_HAND
26 ? ["rightHand", "rightHandEquip", "rightHandTrigger"]26 ? ["rightHand", "rightHandEquip", "rightHandTrigger"]
27 : ["leftHand", "leftHandEquip", "leftHandTrigger"],27 : ["leftHand", "leftHandEquip", "leftHandTrigger"],
scripts/system/controllers/controllerModules/nearActionGrabEntity.js+1−1
@@ -26,7 +26,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); · 25 unmodified lines
26 this.hapticTargetID = null;26 this.hapticTargetID = null;
27 27
28 this.parameters = makeDispatcherModuleParameters(28 this.parameters = makeDispatcherModuleParameters(
29 500,29 140,
30 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],30 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
31 [],31 [],
32 100);32 100);
scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21 this.hyperlink = "";21 this.hyperlink = "";
22 22
23 this.parameters = makeDispatcherModuleParameters(23 this.parameters = makeDispatcherModuleParameters(
24 485,24 125,
25 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],25 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
26 [],26 [],
27 100);27 100);
scripts/system/controllers/controllerModules/nearParentGrabEntity.js+1−1
@@ -39,7 +39,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); · 38 unmodified lines
39 this.cloneAllowed = true;39 this.cloneAllowed = true;
40 40
41 this.parameters = makeDispatcherModuleParameters(41 this.parameters = makeDispatcherModuleParameters(
42 500,42 140,
43 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],43 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
44 [],44 [],
45 100);45 100);
scripts/system/controllers/controllerModules/nearTrigger.js+1−1
@@ -29,7 +29,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); · 28 unmodified lines
29 this.startSent = false;29 this.startSent = false;
30 30
31 this.parameters = makeDispatcherModuleParameters(31 this.parameters = makeDispatcherModuleParameters(
32 480,32 120,
33 this.hand === RIGHT_HAND ? ["rightHandTrigger", "rightHand"] : ["leftHandTrigger", "leftHand"],33 this.hand === RIGHT_HAND ? ["rightHandTrigger", "rightHand"] : ["leftHandTrigger", "leftHand"],
34 [],34 [],
35 100);35 100);
scripts/system/controllers/controllerModules/webSurfaceLaserInput.js+29−3
@@ -22,7 +22,7 @@ Script.include("/~/system/libraries/controllers.js"); · 21 unmodified lines
22 this.running = false;22 this.running = false;
23 23
24 this.parameters = makeDispatcherModuleParameters(24 this.parameters = makeDispatcherModuleParameters(
25 120,25 160,
26 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],26 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
27 [],27 [],
28 100,28 100,
@@ -60,6 +60,30 @@ Script.include("/~/system/libraries/controllers.js"); · 31 unmodified lines
60 return this.hand === RIGHT_HAND ? leftOverlayLaserInput : rightOverlayLaserInput;60 return this.hand === RIGHT_HAND ? leftOverlayLaserInput : rightOverlayLaserInput;
61 };61 };
62 62
63 this.isPointingAtGrabbableEntity = function(controllerData, triggerPressed) {
64 // we are searching for an entity that is not a web entity. We want to be able to
65 // grab a non-web entity if the ray-pick intersects one.
66 var intersection = controllerData.rayPicks[this.hand];
67 if(intersection.type === Picks.INTERSECTED_ENTITY) {
68 // is pointing at an entity.
69 var entityProperty = Entities.getEntityProperties(intersection.objectID);
70 var entityType = entityProperty.type;
71 var isGrabbable = entityIsGrabbable(entityProperty);
72 return (isGrabbable && triggerPressed && entityType !== "Web");
73 } else if (intersection.type === Picks.INTERSECTED_OVERLAY) {
74 var objectID = intersection.objectID;
75 if ((HMD.tabletID && objectID === HMD.tabletID) ||
76 (HMD.tabletScreenID && objectID === HMD.tabletScreenID) ||
77 (HMD.homeButtonID && objectID === HMD.homeButtonID)) {
78 return true;
79 } else {
80 var overlayType = Overlays.getOverlayType(objectID);
81 return overlayType === "web3d" || triggerPressed;
82 }
83 }
84 return false;
85 }
86
63 this.isPointingAtTriggerable = function(controllerData, triggerPressed) {87 this.isPointingAtTriggerable = function(controllerData, triggerPressed) {
64 // allow pointing at tablet, unlocked web entities, or web overlays automatically without pressing trigger,88 // allow pointing at tablet, unlocked web entities, or web overlays automatically without pressing trigger,
65 // but for pointing at locked web entities or non-web overlays user must be pressing trigger89 // but for pointing at locked web entities or non-web overlays user must be pressing trigger
@@ -113,7 +137,8 @@ Script.include("/~/system/libraries/controllers.js"); · 47 unmodified lines
113 var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE &&137 var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE &&
114 controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;138 controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;
115 var allowThisModule = !otherModuleRunning || isTriggerPressed;139 var allowThisModule = !otherModuleRunning || isTriggerPressed;
116 if (allowThisModule && this.isPointingAtTriggerable(controllerData, isTriggerPressed)) {140 if (allowThisModule && this.isPointingAtTriggerable(controllerData, isTriggerPressed)) {
141 //this.isPointingAtGrabbableEntity(controllerData, isTriggerPressed)) {
117 this.updateAllwaysOn();142 this.updateAllwaysOn();
118 if (isTriggerPressed) {143 if (isTriggerPressed) {
119 this.dominantHandOverride = true; // Override dominant hand.144 this.dominantHandOverride = true; // Override dominant hand.
@@ -134,7 +159,8 @@ Script.include("/~/system/libraries/controllers.js"); · 14 unmodified lines
134 var allowThisModule = !otherModuleRunning && !grabModuleNeedsToRun;159 var allowThisModule = !otherModuleRunning && !grabModuleNeedsToRun;
135 var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE;160 var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE;
136 var laserOn = isTriggerPressed || this.parameters.handLaser.allwaysOn;161 var laserOn = isTriggerPressed || this.parameters.handLaser.allwaysOn;
137 if (allowThisModule && (laserOn && this.isPointingAtTriggerable(controllerData, isTriggerPressed))) {162 if (allowThisModule && (laserOn && this.isPointingAtTriggerable(controllerData, isTriggerPressed)) &&
163 this.isPointingAtGrabbableEntity(controllerData, isTriggerPressed)) {
138 this.running = true;164 this.running = true;
139 return makeRunningValues(true, [], []);165 return makeRunningValues(true, [], []);
140 }166 }