mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
make handGrab treat shoulder bumbers and triggers as merged control
This commit is contained in:
parent
d5a90e273e
commit
6b795364c8
1 changed files with 20 additions and 5 deletions
|
@ -148,6 +148,7 @@ function MyController(hand, triggerAction) {
|
||||||
this.state = STATE_OFF;
|
this.state = STATE_OFF;
|
||||||
this.pointer = null; // entity-id of line object
|
this.pointer = null; // entity-id of line object
|
||||||
this.triggerValue = 0; // rolling average of trigger value
|
this.triggerValue = 0; // rolling average of trigger value
|
||||||
|
this.rawTriggerValue = 0;
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
|
@ -244,12 +245,18 @@ function MyController(hand, triggerAction) {
|
||||||
this.pointer = null;
|
this.pointer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updateSmoothedTrigger = function() {
|
this.eitherTrigger = function (value) {
|
||||||
var triggerValue = Controller.getValue(this.triggerAction);
|
_this.rawTriggerValue = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.updateSmoothedTrigger = function () {
|
||||||
|
//var triggerValue = Controller.getValue(this.triggerAction); // this.rawTriggerValue; //
|
||||||
|
var triggerValue = this.rawTriggerValue;
|
||||||
// smooth out trigger value
|
// smooth out trigger value
|
||||||
this.triggerValue = (this.triggerValue * TRIGGER_SMOOTH_RATIO) +
|
this.triggerValue = (this.triggerValue * TRIGGER_SMOOTH_RATIO) +
|
||||||
(triggerValue * (1.0 - TRIGGER_SMOOTH_RATIO));
|
(triggerValue * (1.0 - TRIGGER_SMOOTH_RATIO));
|
||||||
}
|
|
||||||
|
};
|
||||||
|
|
||||||
this.triggerSmoothedSqueezed = function() {
|
this.triggerSmoothedSqueezed = function() {
|
||||||
return this.triggerValue > TRIGGER_ON_VALUE;
|
return this.triggerValue > TRIGGER_ON_VALUE;
|
||||||
|
@ -259,8 +266,9 @@ function MyController(hand, triggerAction) {
|
||||||
return this.triggerValue < TRIGGER_OFF_VALUE;
|
return this.triggerValue < TRIGGER_OFF_VALUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.triggerSqueezed = function() {
|
this.triggerSqueezed = function() {
|
||||||
var triggerValue = Controller.getValue(this.triggerAction);
|
var triggerValue = Controller.getValue(this.triggerAction); // this.rawTriggerValue; //
|
||||||
|
print("triggerSqueezed() triggerValue:" + triggerValue);
|
||||||
return triggerValue > TRIGGER_ON_VALUE;
|
return triggerValue > TRIGGER_ON_VALUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -861,6 +869,12 @@ function MyController(hand, triggerAction) {
|
||||||
var rightController = new MyController(RIGHT_HAND, Controller.Standard.RT);
|
var rightController = new MyController(RIGHT_HAND, Controller.Standard.RT);
|
||||||
var leftController = new MyController(LEFT_HAND, Controller.Standard.LT);
|
var leftController = new MyController(LEFT_HAND, Controller.Standard.LT);
|
||||||
|
|
||||||
|
var mapping = Controller.newMapping("handGrab");
|
||||||
|
mapping.from([Controller.Standard.RB, Controller.Standard.RT]).to(rightController.eitherTrigger);
|
||||||
|
mapping.from([Controller.Standard.LB, Controller.Standard.LT]).to(leftController.eitherTrigger);
|
||||||
|
Controller.enableMapping("handGrab");
|
||||||
|
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
rightController.update();
|
rightController.update();
|
||||||
leftController.update();
|
leftController.update();
|
||||||
|
@ -869,6 +883,7 @@ function update() {
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
rightController.cleanup();
|
rightController.cleanup();
|
||||||
leftController.cleanup();
|
leftController.cleanup();
|
||||||
|
Controller.disableMapping("handGrab");
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
|
Loading…
Reference in a new issue