mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +02:00
viveTouchpadTest.js: don't throw if there is no Vive controller attached.
This commit is contained in:
parent
c91455a291
commit
95ef543f25
1 changed files with 20 additions and 16 deletions
|
@ -46,9 +46,12 @@ function shutdown() {
|
||||||
}
|
}
|
||||||
Script.scriptEnding.connect(shutdown);
|
Script.scriptEnding.connect(shutdown);
|
||||||
|
|
||||||
prevPose = Controller.getPoseValue(Controller.Hardware.Vive.LeftHand);
|
function viveIsConnected() {
|
||||||
|
return Controller.Hardware.Vive;
|
||||||
|
}
|
||||||
|
|
||||||
function update(dt) {
|
function update(dt) {
|
||||||
|
if (viveIsConnected()) {
|
||||||
var thumbDown = Controller.getValue(Controller.Hardware.Vive.RSTouch);
|
var thumbDown = Controller.getValue(Controller.Hardware.Vive.RSTouch);
|
||||||
if (thumbDown) {
|
if (thumbDown) {
|
||||||
var x = Controller.getValue(Controller.Hardware.Vive.RX);
|
var x = Controller.getValue(Controller.Hardware.Vive.RX);
|
||||||
|
@ -65,6 +68,7 @@ function update(dt) {
|
||||||
Entities.editEntity(boxEntity, {color: GRAY});
|
Entities.editEntity(boxEntity, {color: GRAY});
|
||||||
}
|
}
|
||||||
prevThumbDown = thumbDown;
|
prevThumbDown = thumbDown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
|
|
Loading…
Reference in a new issue