mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Merge pull request #6172 from ZappoMan/fixScripts
fix walkApi.js to detect hydra in official way
This commit is contained in:
commit
f61cf843bc
1 changed files with 2 additions and 18 deletions
|
@ -18,24 +18,8 @@ Script.include("./libraries/walkConstants.js");
|
||||||
|
|
||||||
Avatar = function() {
|
Avatar = function() {
|
||||||
// if Hydras are connected, the only way to enable use is to never set any arm joint rotation
|
// if Hydras are connected, the only way to enable use is to never set any arm joint rotation
|
||||||
this.hydraCheck = function() {
|
this.hydraCheck = function () {
|
||||||
// function courtesy of Thijs Wenker (frisbee.js)
|
return Controller.Hardware.Hydra !== undefined;
|
||||||
var numberOfButtons = Controller.getNumberOfButtons();
|
|
||||||
var numberOfTriggers = Controller.getNumberOfTriggers();
|
|
||||||
var numberOfSpatialControls = Controller.getNumberOfSpatialControls();
|
|
||||||
const HYDRA_BUTTONS = 12;
|
|
||||||
const HYDRA_TRIGGERS = 2;
|
|
||||||
const HYDRA_CONTROLLERS_PER_TRIGGER = 2;
|
|
||||||
var controllersPerTrigger = numberOfSpatialControls / numberOfTriggers;
|
|
||||||
if (numberOfButtons == HYDRA_BUTTONS &&
|
|
||||||
numberOfTriggers == HYDRA_TRIGGERS &&
|
|
||||||
controllersPerTrigger == HYDRA_CONTROLLERS_PER_TRIGGER) {
|
|
||||||
print('walk.js info: Razer Hydra detected. Setting arms free (not controlled by script)');
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
print('walk.js info: Razer Hydra not detected. Arms will be controlled by script.');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// settings
|
// settings
|
||||||
this.headFree = true;
|
this.headFree = true;
|
||||||
|
|
Loading…
Reference in a new issue