mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 17:20:12 +02:00
Fix HUD laser while in Shapes app
This commit is contained in:
parent
209d1535c2
commit
3bc1c2963d
3 changed files with 64 additions and 17 deletions
|
@ -72,7 +72,6 @@
|
|||
|
||||
this.processLaser = function(controllerData) {
|
||||
var controllerLocation = controllerData.controllerLocations[this.hand];
|
||||
var otherModuleRunning = this.getOtherModule().running;
|
||||
if ((controllerData.triggerValues[this.hand] < ControllerDispatcherUtils.TRIGGER_ON_VALUE || !controllerLocation.valid) ||
|
||||
this.pointingAtTablet(controllerData)) {
|
||||
return false;
|
||||
|
|
|
@ -128,7 +128,8 @@ Script.include("/~/system/libraries/utils.js");
|
|||
};
|
||||
|
||||
this.run = function(controllerData) {
|
||||
var tabletStylusInput = getEnabledModuleByName(this.hand === RIGHT_HAND ? "RightTabletStylusInput" : "LeftTabletStylusInput");
|
||||
var tabletStylusInput = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightTabletStylusInput" : "LeftTabletStylusInput");
|
||||
if (tabletStylusInput) {
|
||||
var tabletReady = tabletStylusInput.isReady(controllerData);
|
||||
if (tabletReady.active) {
|
||||
|
@ -136,7 +137,8 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}
|
||||
}
|
||||
|
||||
var webLaser = getEnabledModuleByName(this.hand === RIGHT_HAND ? "RightWebSurfaceLaserInput" : "LeftWebSurfaceLaserInput");
|
||||
var webLaser = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightWebSurfaceLaserInput" : "LeftWebSurfaceLaserInput");
|
||||
if (webLaser) {
|
||||
var webLaserReady = webLaser.isReady(controllerData);
|
||||
var target = controllerData.rayPicks[this.hand].objectID;
|
||||
|
@ -146,15 +148,19 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}
|
||||
}
|
||||
|
||||
var hudLaser = getEnabledModuleByName(this.hand === RIGHT_HAND ? "RightHudOverlayPointer" : "LeftHudOverlayPointer");
|
||||
if (hudLaser) {
|
||||
var hudLaserReady = hudLaser.isReady(controllerData);
|
||||
if (hudLaserReady.active) {
|
||||
return this.exitModule();
|
||||
if (!controllerData.triggerClicks[this.hand]) { // Don't grab if trigger pressed when laser starts intersecting.
|
||||
var hudLaser = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHudOverlayPointer" : "LeftHudOverlayPointer");
|
||||
if (hudLaser) {
|
||||
var hudLaserReady = hudLaser.isReady(controllerData);
|
||||
if (hudLaserReady.active) {
|
||||
return this.exitModule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nearOverlay = getEnabledModuleByName(this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay");
|
||||
var nearOverlay = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay");
|
||||
if (nearOverlay) {
|
||||
var nearOverlayReady = nearOverlay.isReady(controllerData);
|
||||
if (nearOverlayReady.active && HMD.tabletID && nearOverlay.grabbedThingID === HMD.tabletID) {
|
||||
|
|
|
@ -19,9 +19,9 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
function InVREditMode(hand) {
|
||||
this.hand = hand;
|
||||
this.disableModules = false;
|
||||
var NO_HAND_LASER = -1; // Invalid hand parameter so that default laser is not displayed.
|
||||
var NO_HAND_LASER = -1; // Invalid hand parameter so that standard laser is not displayed.
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
200, // Not too high otherwise the tablet laser doesn't work.
|
||||
166, // Sllightly lower priority than inEditMode.
|
||||
this.hand === RIGHT_HAND
|
||||
? ["rightHand", "rightHandEquip", "rightHandTrigger"]
|
||||
: ["leftHand", "leftHandEquip", "leftHandTrigger"],
|
||||
|
@ -35,6 +35,35 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
|| (HMD.homeButtonID && objectID === HMD.homeButtonID);
|
||||
};
|
||||
|
||||
// The Shapes app has a non-standard laser: in particular, the laser end dot displays on its own when the laser is
|
||||
// pointing at the Shapes UI. The laser on/off is controlled by this module but the laser is implemented in the Shapes
|
||||
// app.
|
||||
// If, in the future, the Shapes app laser interaction is adopted as a standard UI style then the laser could be
|
||||
// implemented in the controller modules along side the other laser styles.
|
||||
var INVREDIT_MODULE_RUNNING = "Hifi-InVREdit-Module-Running";
|
||||
|
||||
this.runModule = function () {
|
||||
if (!this.running) {
|
||||
Messages.sendLocalMessage(INVREDIT_MODULE_RUNNING, JSON.stringify({
|
||||
hand: this.hand,
|
||||
running: true
|
||||
}));
|
||||
this.running = true;
|
||||
}
|
||||
return makeRunningValues(true, [], []);
|
||||
};
|
||||
|
||||
this.exitModule = function () {
|
||||
if (this.running) {
|
||||
Messages.sendLocalMessage(INVREDIT_MODULE_RUNNING, JSON.stringify({
|
||||
hand: this.hand,
|
||||
running: false
|
||||
}));
|
||||
this.running = false;
|
||||
}
|
||||
return makeRunningValues(false, [], []);
|
||||
};
|
||||
|
||||
this.isReady = function (controllerData) {
|
||||
if (this.disableModules) {
|
||||
return makeRunningValues(true, [], []);
|
||||
|
@ -45,7 +74,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
this.run = function (controllerData) {
|
||||
// Default behavior if disabling is not enabled.
|
||||
if (!this.disableModules) {
|
||||
return makeRunningValues(false, [], []);
|
||||
return this.exitModule();
|
||||
}
|
||||
|
||||
// Tablet stylus.
|
||||
|
@ -55,7 +84,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
if (tabletStylusInput) {
|
||||
var tabletReady = tabletStylusInput.isReady(controllerData);
|
||||
if (tabletReady.active) {
|
||||
return makeRunningValues(false, [], []);
|
||||
return this.exitModule();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +96,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
var overlayLaserReady = overlayLaser.isReady(controllerData);
|
||||
var target = controllerData.rayPicks[this.hand].objectID;
|
||||
if (overlayLaserReady.active && this.pointingAtTablet(target)) {
|
||||
return makeRunningValues(false, [], []);
|
||||
return this.exitModule();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +107,20 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
if (nearOverlay) {
|
||||
var nearOverlayReady = nearOverlay.isReady(controllerData);
|
||||
if (nearOverlayReady.active && HMD.tabletID && nearOverlay.grabbedThingID === HMD.tabletID) {
|
||||
return makeRunningValues(false, [], []);
|
||||
return this.exitModule();
|
||||
}
|
||||
}
|
||||
|
||||
// HUD overlay.
|
||||
if (!controllerData.triggerClicks[this.hand]) {
|
||||
var hudLaser = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHudOverlayPointer"
|
||||
: "LeftHudOverlayPointer");
|
||||
if (hudLaser) {
|
||||
var hudLaserReady = hudLaser.isReady(controllerData);
|
||||
if (hudLaserReady.active) {
|
||||
return this.exitModule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,12 +131,12 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
if (teleporter) {
|
||||
var teleporterReady = teleporter.isReady(controllerData);
|
||||
if (teleporterReady.active) {
|
||||
return makeRunningValues(false, [], []);
|
||||
return this.exitModule();
|
||||
}
|
||||
}
|
||||
|
||||
// Other behaviors are disabled.
|
||||
return makeRunningValues(true, [], []);
|
||||
return this.runModule();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue