mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 06:42:57 +02:00
fix overlay issues during interstitial mode
This commit is contained in:
parent
91df342ae9
commit
296ea8a5af
1 changed files with 40 additions and 0 deletions
|
@ -20,6 +20,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.hand = hand;
|
||||
this.otherHand = this.hand === RIGHT_HAND ? LEFT_HAND : RIGHT_HAND;
|
||||
this.running = false;
|
||||
this.ignoredOverlays = [];
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
160,
|
||||
|
@ -67,6 +68,42 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
return this.hand === RIGHT_HAND ? leftOverlayLaserInput : rightOverlayLaserInput;
|
||||
};
|
||||
|
||||
this.addOverlayToIgnoreList = function(controllerData) {
|
||||
if (Window.interstitialModeEnabled && !Window.isPhysicsEnabled()) {
|
||||
var intersection = controllerData.rayPicks[this.hand];
|
||||
var objectID = intersection.objectID;
|
||||
|
||||
if (intersection.type === Picks.INTERSECTED_OVERLAY) {
|
||||
var overlayIndex = this.ignoredOverlays.indexOf(objectID);
|
||||
|
||||
if (overlayIndex === -1) {
|
||||
var overlayName = Overlays.getProperty(objectID, "name");
|
||||
if (overlayName !== "Loading-Destination-Card-Text" && overlayName !== "Loading-Destination-Card-GoTo-Image" &&
|
||||
overlayName !== "Loading-Destination-Card-GoTo-Image-Hover") {
|
||||
var data = {
|
||||
action: 'add',
|
||||
id: objectID
|
||||
};
|
||||
Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data));
|
||||
this.ignoredOverlays.push(objectID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.restoreIgnoredOverlays = function() {
|
||||
for (var index = 0; index < this.ignoredOverlays.length; index++) {
|
||||
var data = {
|
||||
action: 'remove',
|
||||
id: this.ignoredOverlays[index]
|
||||
};
|
||||
Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data));
|
||||
}
|
||||
|
||||
this.ignoredOverlays = [];
|
||||
};
|
||||
|
||||
this.isPointingAtTriggerable = function(controllerData, triggerPressed, checkEntitiesOnly) {
|
||||
// allow pointing at tablet, unlocked web entities, or web overlays automatically without pressing trigger,
|
||||
// but for pointing at locked web entities or non-web overlays user must be pressing trigger
|
||||
|
@ -143,6 +180,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
var allowThisModule = !otherModuleRunning && !grabModuleNeedsToRun;
|
||||
var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE;
|
||||
var laserOn = isTriggerPressed || this.parameters.handLaser.allwaysOn;
|
||||
this.addOverlayToIgnoreList(controllerData);
|
||||
if (allowThisModule) {
|
||||
if (isTriggerPressed && !this.isPointingAtTriggerable(controllerData, isTriggerPressed, true)) {
|
||||
// if trigger is down + not pointing at a web entity, keep running web surface laser
|
||||
|
@ -156,6 +194,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.deleteContextOverlay();
|
||||
this.running = false;
|
||||
this.dominantHandOverride = false;
|
||||
this.restoreIgnoredOverlays();
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +202,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.deleteContextOverlay();
|
||||
this.running = false;
|
||||
this.dominantHandOverride = false;
|
||||
this.restoreIgnoredOverlays();
|
||||
return makeRunningValues(false, [], []);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue