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
3737 this.highlightedEntities = [];
3838
3939 this.parameters = dispatcherUtils.makeDispatcherModuleParameters(
40− 480,
40+ 120,
4141 this.hand === dispatcherUtils.RIGHT_HAND ? ["rightHand"] : ["leftHand"],
4242 [],
4343 100);
scripts/system/controllers/controllerModules/inEditMode.js+1−1
@@ -30,7 +30,7 @@ Script.include("/~/system/libraries/utils.js"); · 29 unmodified lines
3030 this.reticleMaxY;
3131
3232 this.parameters = makeDispatcherModuleParameters(
33− 160,
33+ 200,
3434 this.hand === RIGHT_HAND ? ["rightHand", "rightHandEquip", "rightHandTrigger"] : ["leftHand", "leftHandEquip", "leftHandTrigger"],
3535 [],
3636 100,
scripts/system/controllers/controllerModules/inVREditMode.js+1−1
@@ -21,7 +21,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); · 20 unmodified lines
2121 this.disableModules = false;
2222 var NO_HAND_LASER = -1; // Invalid hand parameter so that default laser is not displayed.
2323 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.
2525 this.hand === RIGHT_HAND
2626 ? ["rightHand", "rightHandEquip", "rightHandTrigger"]
2727 : ["leftHand", "leftHandEquip", "leftHandTrigger"],
scripts/system/controllers/controllerModules/nearActionGrabEntity.js+1−1
@@ -26,7 +26,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); · 25 unmodified lines
2626 this.hapticTargetID = null;
2727
2828 this.parameters = makeDispatcherModuleParameters(
29− 500,
29+ 140,
3030 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
3131 [],
3232 100);
scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 this.hyperlink = "";
2222
2323 this.parameters = makeDispatcherModuleParameters(
24− 485,
24+ 125,
2525 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
2626 [],
2727 100);
scripts/system/controllers/controllerModules/nearParentGrabEntity.js+1−1
@@ -39,7 +39,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); · 38 unmodified lines
3939 this.cloneAllowed = true;
4040
4141 this.parameters = makeDispatcherModuleParameters(
42− 500,
42+ 140,
4343 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
4444 [],
4545 100);
scripts/system/controllers/controllerModules/nearTrigger.js+1−1
@@ -29,7 +29,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); · 28 unmodified lines
2929 this.startSent = false;
3030
3131 this.parameters = makeDispatcherModuleParameters(
32− 480,
32+ 120,
3333 this.hand === RIGHT_HAND ? ["rightHandTrigger", "rightHand"] : ["leftHandTrigger", "leftHand"],
3434 [],
3535 100);
scripts/system/controllers/controllerModules/webSurfaceLaserInput.js+29−3
@@ -22,7 +22,7 @@ Script.include("/~/system/libraries/controllers.js"); · 21 unmodified lines
2222 this.running = false;
2323
2424 this.parameters = makeDispatcherModuleParameters(
25− 120,
25+ 160,
2626 this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
2727 [],
2828 100,
@@ -60,6 +60,30 @@ Script.include("/~/system/libraries/controllers.js"); · 31 unmodified lines
6060 return this.hand === RIGHT_HAND ? leftOverlayLaserInput : rightOverlayLaserInput;
6161 };
6262
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+
6387 this.isPointingAtTriggerable = function(controllerData, triggerPressed) {
6488 // allow pointing at tablet, unlocked web entities, or web overlays automatically without pressing trigger,
6589 // 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
113137 var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE &&
114138 controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;
115139 var allowThisModule = !otherModuleRunning || isTriggerPressed;
116− if (allowThisModule && this.isPointingAtTriggerable(controllerData, isTriggerPressed)) {
140+ if (allowThisModule && this.isPointingAtTriggerable(controllerData, isTriggerPressed)) {
141+ //this.isPointingAtGrabbableEntity(controllerData, isTriggerPressed)) {
117142 this.updateAllwaysOn();
118143 if (isTriggerPressed) {
119144 this.dominantHandOverride = true; // Override dominant hand.
@@ -134,7 +159,8 @@ Script.include("/~/system/libraries/controllers.js"); · 14 unmodified lines
134159 var allowThisModule = !otherModuleRunning && !grabModuleNeedsToRun;
135160 var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE;
136161 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)) {
138164 this.running = true;
139165 return makeRunningValues(true, [], []);
140166 }