mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 05:23:33 +02:00
Add grip button polling.
This commit is contained in:
parent
a3c4747290
commit
58906d84eb
1 changed files with 20 additions and 0 deletions
|
@ -328,6 +328,8 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
grabMapping = Controller.newMapping(mappingName);
|
grabMapping = Controller.newMapping(mappingName);
|
||||||
grabMapping.from(Controller.Standard.LT).peek().to(_this.getLeftTrigger);
|
grabMapping.from(Controller.Standard.LT).peek().to(_this.getLeftTrigger);
|
||||||
grabMapping.from(Controller.Standard.RT).peek().to(_this.getRightTrigger);
|
grabMapping.from(Controller.Standard.RT).peek().to(_this.getRightTrigger);
|
||||||
|
grabMapping.from(Controller.Standard.LeftGrip).peek().to(_this.setLeftGrip);
|
||||||
|
grabMapping.from(Controller.Standard.RightGrip).peek().to(_this.setRightGrip);
|
||||||
Controller.enableMapping(mappingName);
|
Controller.enableMapping(mappingName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -337,6 +339,8 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
|
|
||||||
this.leftTrigger = 0.0;
|
this.leftTrigger = 0.0;
|
||||||
this.rightTrigger = 0.0;
|
this.rightTrigger = 0.0;
|
||||||
|
this.leftGrip = 0.0;
|
||||||
|
this.rightGrip = 0.0;
|
||||||
|
|
||||||
this.getDominantHand = function () {
|
this.getDominantHand = function () {
|
||||||
return (MyAvatar.getDominantHand() === "left") ? LEFT_HAND : RIGHT_HAND;
|
return (MyAvatar.getDominantHand() === "left") ? LEFT_HAND : RIGHT_HAND;
|
||||||
|
@ -362,6 +366,22 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
return (MyAvatar.getDominantHand() === "left") ? (_this.rightTrigger) : (_this.leftTrigger);
|
return (MyAvatar.getDominantHand() === "left") ? (_this.rightTrigger) : (_this.leftTrigger);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setLeftGrip = function (value) {
|
||||||
|
this.leftGrip = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setRightGrip = function (value) {
|
||||||
|
this.rightGrip = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getDominantGrip = function () {
|
||||||
|
return (MyAvatar.getDominantHand() === "left" ? (_this.leftGrip) : (_this.rightGrip));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getOffhandGrip = function () {
|
||||||
|
return (MyAvatar.getDominantHand() === "left" ? (_this.rightGrip) : (_this.leftGrip));
|
||||||
|
}
|
||||||
|
|
||||||
this.shouldShowLaser = function () {
|
this.shouldShowLaser = function () {
|
||||||
return (_this.getOffHandTrigger() > TRIGGER_ON_VALUE) ? true : false;
|
return (_this.getOffHandTrigger() > TRIGGER_ON_VALUE) ? true : false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue