mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 04:07:11 +02:00
adding controller haptic feedback to tablet onPress
This commit is contained in:
parent
db2f6810bd
commit
416a47cfc7
1 changed files with 13 additions and 0 deletions
|
@ -173,6 +173,18 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
}
|
||||
}
|
||||
|
||||
var HAPTIC_STYLUS_STRENGTH = 1.0;
|
||||
var HAPTIC_STYLUS_DURATION = 20.0;
|
||||
function mousePress(overlayID, event) {
|
||||
if (HMD.active) {
|
||||
if (event.id === leftTabletStylusInput.pointer && event.button === "Primary") {
|
||||
Controller.triggerHapticPulse(HAPTIC_STYLUS_STRENGTH, HAPTIC_STYLUS_DURATION, LEFT_HAND);
|
||||
} else if (event.id === rightTabletStylusInput.pointer && event.button === "Primary") {
|
||||
Controller.triggerHapticPulse(HAPTIC_STYLUS_STRENGTH, HAPTIC_STYLUS_DURATION, RIGHT_HAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var leftTabletStylusInput = new TabletStylusInput(LEFT_HAND);
|
||||
var rightTabletStylusInput = new TabletStylusInput(RIGHT_HAND);
|
||||
|
||||
|
@ -181,6 +193,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
Overlays.hoverEnterOverlay.connect(mouseHoverEnter);
|
||||
Overlays.hoverLeaveOverlay.connect(mouseHoverLeave);
|
||||
Overlays.mousePressOnOverlay.connect(mousePress);
|
||||
|
||||
this.cleanup = function () {
|
||||
leftTabletStylusInput.cleanup();
|
||||
|
|
Loading…
Reference in a new issue