mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:57:59 +02:00
Prevent HUD and Web Surface lasers from interrupting FarGrab.
This commit is contained in:
parent
e4958b3b0f
commit
12ffa41984
2 changed files with 35 additions and 2 deletions
|
@ -30,6 +30,20 @@
|
||||||
100,
|
100,
|
||||||
makeLaserParams((this.hand + HUD_LASER_OFFSET), false));
|
makeLaserParams((this.hand + HUD_LASER_OFFSET), false));
|
||||||
|
|
||||||
|
this.getFarGrab = function () {
|
||||||
|
return getEnabledModuleByName(this.hand === RIGHT_HAND ? ("RightFarGrabEntity") : ("LeftFarGrabEntity"));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.farGrabActive = function () {
|
||||||
|
var farGrab = this.getFarGrab();
|
||||||
|
// farGrab will be null if module isn't loaded.
|
||||||
|
if (farGrab) {
|
||||||
|
return farGrab.targetIsNull();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.getOtherHandController = function() {
|
this.getOtherHandController = function() {
|
||||||
return (this.hand === RIGHT_HAND) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
return (this.hand === RIGHT_HAND) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
||||||
};
|
};
|
||||||
|
@ -79,7 +93,7 @@
|
||||||
|
|
||||||
this.isReady = function (controllerData) {
|
this.isReady = function (controllerData) {
|
||||||
var otherModuleRunning = this.getOtherModule().running;
|
var otherModuleRunning = this.getOtherModule().running;
|
||||||
if (!otherModuleRunning && HMD.active) {
|
if (!otherModuleRunning && HMD.active && !this.farGrabActive()) {
|
||||||
if (this.processLaser(controllerData)) {
|
if (this.processLaser(controllerData)) {
|
||||||
this.running = true;
|
this.running = true;
|
||||||
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
||||||
|
|
|
@ -37,6 +37,20 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
100,
|
100,
|
||||||
makeLaserParams(hand, true));
|
makeLaserParams(hand, true));
|
||||||
|
|
||||||
|
this.getFarGrab = function () {
|
||||||
|
return getEnabledModuleByName(this.hand === RIGHT_HAND ? ("RightFarGrabEntity") : ("LeftFarGrabEntity"));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.farGrabActive = function () {
|
||||||
|
var farGrab = this.getFarGrab();
|
||||||
|
// farGrab will be null if module isn't loaded.
|
||||||
|
if (farGrab) {
|
||||||
|
return farGrab.targetIsNull();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.grabModuleWantsNearbyOverlay = function(controllerData) {
|
this.grabModuleWantsNearbyOverlay = function(controllerData) {
|
||||||
if (controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE || controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) {
|
if (controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE || controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) {
|
||||||
var nearGrabName = this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay";
|
var nearGrabName = this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay";
|
||||||
|
@ -185,6 +199,11 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
this.dominantHandOverride = false;
|
this.dominantHandOverride = false;
|
||||||
|
|
||||||
this.isReady = function (controllerData) {
|
this.isReady = function (controllerData) {
|
||||||
|
// Trivial rejection for when FarGrab is active.
|
||||||
|
if (this.farGrabActive()) {
|
||||||
|
return makeRunningValues(false, [], []);
|
||||||
|
}
|
||||||
|
|
||||||
var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE &&
|
var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE &&
|
||||||
controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;
|
controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE;
|
||||||
var type = this.getInteractableType(controllerData, isTriggerPressed, false);
|
var type = this.getInteractableType(controllerData, isTriggerPressed, false);
|
||||||
|
|
Loading…
Reference in a new issue