mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 12:12:32 +02:00
Use laser from dominant hand if both hands are pointing at the tablet
This commit is contained in:
parent
02f4085368
commit
9f7a2b18e6
1 changed files with 10 additions and 3 deletions
|
@ -81,10 +81,15 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
this.parameters.handLaser.allwaysOn = !Settings.getValue(PREFER_STYLUS_OVER_LASER, false);
|
this.parameters.handLaser.allwaysOn = !Settings.getValue(PREFER_STYLUS_OVER_LASER, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.dominantHand = function () {
|
||||||
|
return MyAvatar.getDominantHand() === "right" ? 1 : 0;
|
||||||
|
};
|
||||||
|
|
||||||
this.isReady = function (controllerData) {
|
this.isReady = function (controllerData) {
|
||||||
var otherModuleRunning = this.getOtherModule().running;
|
var otherModuleRunning = this.getOtherModule().running;
|
||||||
if ((this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) &&
|
otherModuleRunning = otherModuleRunning && this.dominantHand() !== this.hand;
|
||||||
!otherModuleRunning) {
|
if (!otherModuleRunning
|
||||||
|
&& (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData))) {
|
||||||
this.updateAllwaysOn();
|
this.updateAllwaysOn();
|
||||||
if (this.parameters.handLaser.allwaysOn || controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE) {
|
if (this.parameters.handLaser.allwaysOn || controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE) {
|
||||||
return makeRunningValues(true, [], []);
|
return makeRunningValues(true, [], []);
|
||||||
|
@ -94,8 +99,10 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.run = function (controllerData, deltaTime) {
|
this.run = function (controllerData, deltaTime) {
|
||||||
|
var otherModuleRunning = this.getOtherModule().running;
|
||||||
|
otherModuleRunning = otherModuleRunning && this.dominantHand() !== this.hand;
|
||||||
var grabModuleNeedsToRun = this.grabModuleWantsNearbyOverlay(controllerData);
|
var grabModuleNeedsToRun = this.grabModuleWantsNearbyOverlay(controllerData);
|
||||||
if (!grabModuleNeedsToRun && (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE
|
if (!otherModuleRunning && !grabModuleNeedsToRun && (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE
|
||||||
|| this.parameters.handLaser.allwaysOn
|
|| this.parameters.handLaser.allwaysOn
|
||||||
&& (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)))) {
|
&& (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)))) {
|
||||||
this.running = true;
|
this.running = true;
|
||||||
|
|
Loading…
Reference in a new issue