mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:24:36 +02:00
only handle trigger events when overlays are shown
This commit is contained in:
parent
61975fe33a
commit
946c7d4644
1 changed files with 17 additions and 15 deletions
|
@ -168,28 +168,30 @@ function controllerComputePickRay() {
|
||||||
MyAvatar.position);
|
MyAvatar.position);
|
||||||
// This gets point direction right, but if you want general quaternion it would be more complicated:
|
// This gets point direction right, but if you want general quaternion it would be more complicated:
|
||||||
var controllerDirection = Quat.getUp(Quat.multiply(MyAvatar.orientation, controllerPose.rotation));
|
var controllerDirection = Quat.getUp(Quat.multiply(MyAvatar.orientation, controllerPose.rotation));
|
||||||
return {origin: controllerPosition, direction: controllerDirection};
|
return { origin: controllerPosition, direction: controllerDirection };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeTriggerHandler(hand) {
|
function makeTriggerHandler(hand) {
|
||||||
return function (value) {
|
return function (value) {
|
||||||
if (!triggered && (value > TRIGGER_GRAB_VALUE)) { // should we smooth?
|
if (isShowingOverlays) {
|
||||||
triggered = true;
|
if (!triggered && (value > TRIGGER_GRAB_VALUE)) { // should we smooth?
|
||||||
if (activeHand !== hand) {
|
triggered = true;
|
||||||
// No switching while the other is already triggered, so no need to release.
|
if (activeHand !== hand) {
|
||||||
activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
// No switching while the other is already triggered, so no need to release.
|
||||||
}
|
activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand;
|
||||||
|
|
||||||
var pickRay = controllerComputePickRay();
|
|
||||||
if (pickRay) {
|
|
||||||
var overlayIntersection = Overlays.findRayIntersection(pickRay);
|
|
||||||
if (overlayIntersection.intersects) {
|
|
||||||
handleSelectedOverlay(overlayIntersection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pickRay = controllerComputePickRay();
|
||||||
|
if (pickRay) {
|
||||||
|
var overlayIntersection = Overlays.findRayIntersection(pickRay);
|
||||||
|
if (overlayIntersection.intersects) {
|
||||||
|
handleSelectedOverlay(overlayIntersection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (triggered && (value < TRIGGER_OFF_VALUE)) {
|
||||||
|
triggered = false;
|
||||||
}
|
}
|
||||||
} else if (triggered && (value < TRIGGER_OFF_VALUE)) {
|
|
||||||
triggered = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue