mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 05:33:10 +02:00
disable far grab when on hud
This commit is contained in:
parent
febfa409d0
commit
dc8d0c9604
4 changed files with 34 additions and 1 deletions
|
@ -196,6 +196,10 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
RayPick.getPrevRayPickResult(_this.leftControllerRayPick),
|
||||
RayPick.getPrevRayPickResult(_this.rightControllerRayPick)
|
||||
];
|
||||
var hudRayPicks = [
|
||||
RayPick.getPrevRayPickResult(_this.leftControllerHudRayPick),
|
||||
RayPick.getPrevRayPickResult(_this.rightControllerHudRayPick)
|
||||
];
|
||||
// if the pickray hit something very nearby, put it into the nearby entities list
|
||||
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||
|
||||
|
@ -234,7 +238,8 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
nearbyEntityProperties: nearbyEntityProperties,
|
||||
nearbyEntityPropertiesByID: nearbyEntityPropertiesByID,
|
||||
nearbyOverlayIDs: nearbyOverlayIDs,
|
||||
rayPicks: rayPicks
|
||||
rayPicks: rayPicks,
|
||||
hudRayPicks: hudRayPicks
|
||||
};
|
||||
|
||||
// check for plugins that would like to start. ask in order of increasing priority value
|
||||
|
@ -298,18 +303,36 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
enabled: true
|
||||
});
|
||||
|
||||
this.mouseHudRayPick = RayPick.createRayPick({
|
||||
joint: "Mouse",
|
||||
filter: RayPick.PICK_HUD,
|
||||
enabled: true
|
||||
});
|
||||
|
||||
this.leftControllerRayPick = RayPick.createRayPick({
|
||||
joint: "_CONTROLLER_LEFTHAND",
|
||||
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS,
|
||||
enabled: true,
|
||||
maxDistance: DEFAULT_SEARCH_SPHERE_DISTANCE
|
||||
});
|
||||
this.leftControllerHudRayPick = RayPick.createRayPick({
|
||||
joint: "_CONTROLLER_LEFTHAND",
|
||||
filter: RayPick.PICK_HUD,
|
||||
enabled: true,
|
||||
maxDistance: DEFAULT_SEARCH_SPHERE_DISTANCE
|
||||
});
|
||||
this.rightControllerRayPick = RayPick.createRayPick({
|
||||
joint: "_CONTROLLER_RIGHTHAND",
|
||||
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS,
|
||||
enabled: true,
|
||||
maxDistance: DEFAULT_SEARCH_SPHERE_DISTANCE
|
||||
});
|
||||
this.rightControllerHudRayPick = RayPick.createRayPick({
|
||||
joint: "_CONTROLLER_RIGHTHAND",
|
||||
filter: RayPick.PICK_HUD,
|
||||
enabled: true,
|
||||
maxDistance: DEFAULT_SEARCH_SPHERE_DISTANCE
|
||||
});
|
||||
|
||||
|
||||
this.cleanup = function () {
|
||||
|
@ -318,6 +341,8 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
// RayPick.removeRayPick(_this.mouseRayPick);
|
||||
RayPick.removeRayPick(_this.leftControllerRayPick);
|
||||
RayPick.removeRayPick(_this.rightControllerRayPick);
|
||||
RayPick.removeRayPick(_this.rightControllerHudRayPick);
|
||||
RayPick.removeRayPick(_this.leftControllerHudRayPick);
|
||||
};
|
||||
|
||||
Script.scriptEnding.connect(this.cleanup);
|
||||
|
|
|
@ -376,6 +376,8 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
}
|
||||
|
||||
var rayPickInfo = controllerData.rayPicks[this.hand];
|
||||
var hudRayPickInfo = controllerData.hudRayPicks[this.hand];
|
||||
var hudPoint2d = HMD.overlayFromWorldPoint(hudRayPickInfo.intersection);
|
||||
if (rayPickInfo.type == RayPick.INTERSECTED_ENTITY) {
|
||||
var entityID = rayPickInfo.objectID;
|
||||
var targetProps = Entities.getEntityProperties(entityID, ["dynamic", "shapeType", "position",
|
||||
|
@ -397,6 +399,10 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.startFarGrabAction(controllerData, targetProps);
|
||||
}
|
||||
}
|
||||
} else if (Reticle.pointingAtSystemOverlay || Overlays.getOverlayAtPoint(hudPoint2d || Reticle.position)) {
|
||||
this.endNearGrabAction();
|
||||
this.laserPointerOff();
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
}
|
||||
return makeRunningValues(true, [], []);
|
||||
|
|
|
@ -57,6 +57,7 @@ Script.include("/~/system/controllers/controllerDispatcherUtils.js");
|
|||
};
|
||||
|
||||
this.continueNearTrigger = function (controllerData) {
|
||||
print("-------> continue near trigger <-------");
|
||||
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
||||
Entities.callEntityMethod(this.targetEntityID, "continueNearTrigger", args);
|
||||
};
|
||||
|
|
|
@ -639,6 +639,7 @@ function update() {
|
|||
|
||||
// If there's a HUD element at the (newly moved) reticle, just make it visible and bail.
|
||||
if (isPointingAtOverlay(hudPoint2d) && isPointerEnabled) {
|
||||
//print("--------> pointing at HUD <--------");
|
||||
if (HMD.active) {
|
||||
Reticle.depth = hudReticleDistance();
|
||||
|
||||
|
|
Loading…
Reference in a new issue