mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 17:50:42 +02:00
Merge pull request #15967 from sabrina-shanman/picks_too-many_grab-enabled
(BUGZ-955) Disable unnecessary picking (conservative subset)
This commit is contained in:
commit
b799abdac1
4 changed files with 41 additions and 7 deletions
|
@ -285,6 +285,21 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable/disable controller raypicking depending on whether we are in HMD
|
||||||
|
if (HMD.active) {
|
||||||
|
Pointers.enablePointer(_this.leftPointer);
|
||||||
|
Pointers.enablePointer(_this.rightPointer);
|
||||||
|
Pointers.enablePointer(_this.leftHudPointer);
|
||||||
|
Pointers.enablePointer(_this.rightHudPointer);
|
||||||
|
Pointers.enablePointer(_this.mouseRayPointer);
|
||||||
|
} else {
|
||||||
|
Pointers.disablePointer(_this.leftPointer);
|
||||||
|
Pointers.disablePointer(_this.rightPointer);
|
||||||
|
Pointers.disablePointer(_this.leftHudPointer);
|
||||||
|
Pointers.disablePointer(_this.rightHudPointer);
|
||||||
|
Pointers.disablePointer(_this.mouseRayPointer);
|
||||||
|
}
|
||||||
|
|
||||||
// raypick for each controller
|
// raypick for each controller
|
||||||
var rayPicks = [
|
var rayPicks = [
|
||||||
Pointers.getPrevPickResult(_this.leftPointer),
|
Pointers.getPrevPickResult(_this.leftPointer),
|
||||||
|
@ -294,7 +309,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
Pointers.getPrevPickResult(_this.leftHudPointer),
|
Pointers.getPrevPickResult(_this.leftHudPointer),
|
||||||
Pointers.getPrevPickResult(_this.rightHudPointer)
|
Pointers.getPrevPickResult(_this.rightHudPointer)
|
||||||
];
|
];
|
||||||
var mouseRayPick = Pointers.getPrevPickResult(_this.mouseRayPick);
|
var mouseRayPointer = Pointers.getPrevPickResult(_this.mouseRayPointer);
|
||||||
// if the pickray hit something very nearby, put it into the nearby entities list
|
// if the pickray hit something very nearby, put it into the nearby entities list
|
||||||
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||||
|
|
||||||
|
@ -365,7 +380,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
nearbyOverlayIDs: nearbyOverlayIDs,
|
nearbyOverlayIDs: nearbyOverlayIDs,
|
||||||
rayPicks: rayPicks,
|
rayPicks: rayPicks,
|
||||||
hudRayPicks: hudRayPicks,
|
hudRayPicks: hudRayPicks,
|
||||||
mouseRayPick: mouseRayPick
|
mouseRayPointer: mouseRayPointer
|
||||||
};
|
};
|
||||||
if (PROFILE) {
|
if (PROFILE) {
|
||||||
Script.endProfileRange("dispatch.gather");
|
Script.endProfileRange("dispatch.gather");
|
||||||
|
@ -530,7 +545,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
hand: RIGHT_HAND
|
hand: RIGHT_HAND
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mouseRayPick = Pointers.createPointer(PickType.Ray, {
|
this.mouseRayPointer = Pointers.createPointer(PickType.Ray, {
|
||||||
joint: "Mouse",
|
joint: "Mouse",
|
||||||
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
|
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -579,7 +594,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
this.cleanup = function () {
|
this.cleanup = function () {
|
||||||
Controller.disableMapping(MAPPING_NAME);
|
Controller.disableMapping(MAPPING_NAME);
|
||||||
_this.pointerManager.removePointers();
|
_this.pointerManager.removePointers();
|
||||||
Pointers.removePointer(this.mouseRayPick);
|
Pointers.removePointer(this.mouseRayPointer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
Reticle.depth = Vec3.distance(reticlePositionOnHUD, HMD.position);
|
Reticle.depth = Vec3.distance(reticlePositionOnHUD, HMD.position);
|
||||||
} else {
|
} else {
|
||||||
var APPARENT_MAXIMUM_DEPTH = 100.0;
|
var APPARENT_MAXIMUM_DEPTH = 100.0;
|
||||||
var result = controllerData.mouseRayPick;
|
var result = controllerData.mouseRayPointer;
|
||||||
Reticle.depth = result.intersects ? result.distance : APPARENT_MAXIMUM_DEPTH;
|
Reticle.depth = result.intersects ? result.distance : APPARENT_MAXIMUM_DEPTH;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -366,7 +366,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
var offset = _this.pickHeightOffset * capsuleRatio;
|
var offset = _this.pickHeightOffset * capsuleRatio;
|
||||||
|
|
||||||
_this.teleportHandCollisionPick = Picks.createPick(PickType.Collision, {
|
_this.teleportHandCollisionPick = Picks.createPick(PickType.Collision, {
|
||||||
enabled: true,
|
enabled: false,
|
||||||
parentID: Pointers.getPointerProperties(_this.teleportParabolaHandCollisions).renderStates["collision"].end,
|
parentID: Pointers.getPointerProperties(_this.teleportParabolaHandCollisions).renderStates["collision"].end,
|
||||||
filter: Picks.PICK_ENTITIES | Picks.PICK_AVATARS,
|
filter: Picks.PICK_ENTITIES | Picks.PICK_AVATARS,
|
||||||
shape: {
|
shape: {
|
||||||
|
@ -382,7 +382,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
});
|
});
|
||||||
|
|
||||||
_this.teleportHeadCollisionPick = Picks.createPick(PickType.Collision, {
|
_this.teleportHeadCollisionPick = Picks.createPick(PickType.Collision, {
|
||||||
enabled: true,
|
enabled: false,
|
||||||
parentID: Pointers.getPointerProperties(_this.teleportParabolaHeadCollisions).renderStates["collision"].end,
|
parentID: Pointers.getPointerProperties(_this.teleportParabolaHeadCollisions).renderStates["collision"].end,
|
||||||
filter: Picks.PICK_ENTITIES | Picks.PICK_AVATARS,
|
filter: Picks.PICK_ENTITIES | Picks.PICK_AVATARS,
|
||||||
shape: {
|
shape: {
|
||||||
|
|
|
@ -221,6 +221,20 @@ function Grabber() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grabber.prototype.setPicksAndPointersEnabled = function(enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
Picks.enablePick(this.mouseRayOverlays);
|
||||||
|
Pointers.enablePointer(this.mouseRayEntities);
|
||||||
|
} else {
|
||||||
|
Picks.disablePick(this.mouseRayOverlays);
|
||||||
|
Pointers.disablePointer(this.mouseRayEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Grabber.prototype.displayModeChanged = function(isHMDMode) {
|
||||||
|
this.setPicksAndPointersEnabled(!isHMDMode);
|
||||||
|
}
|
||||||
|
|
||||||
Grabber.prototype.computeNewGrabPlane = function() {
|
Grabber.prototype.computeNewGrabPlane = function() {
|
||||||
if (!this.isGrabbing) {
|
if (!this.isGrabbing) {
|
||||||
return;
|
return;
|
||||||
|
@ -488,6 +502,10 @@ Grabber.prototype.cleanup = function() {
|
||||||
|
|
||||||
var grabber = new Grabber();
|
var grabber = new Grabber();
|
||||||
|
|
||||||
|
function displayModeChanged(isHMDMode) {
|
||||||
|
grabber.displayModeChanged(isHMDMode);
|
||||||
|
}
|
||||||
|
|
||||||
function pressEvent(event) {
|
function pressEvent(event) {
|
||||||
grabber.pressEvent(event);
|
grabber.pressEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -517,6 +535,7 @@ Controller.mouseMoveEvent.connect(moveEvent);
|
||||||
Controller.mouseReleaseEvent.connect(releaseEvent);
|
Controller.mouseReleaseEvent.connect(releaseEvent);
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||||
|
HMD.displayModeChanged.connect(displayModeChanged);
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
Loading…
Reference in a new issue