mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:03:53 +02:00
fix mouse visiblity
This commit is contained in:
parent
dda20c1ef5
commit
b1b31444f0
2 changed files with 20 additions and 2 deletions
|
@ -236,6 +236,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
RayPick.getPrevRayPickResult(_this.leftControllerHudRayPick),
|
||||
RayPick.getPrevRayPickResult(_this.rightControllerHudRayPick)
|
||||
];
|
||||
var mouseRayPick = RayPick.getPrevRayPickResult(_this.mouseRayPick);
|
||||
// if the pickray hit something very nearby, put it into the nearby entities list
|
||||
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||
|
||||
|
@ -274,7 +275,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
nearbyEntityPropertiesByID: nearbyEntityPropertiesByID,
|
||||
nearbyOverlayIDs: nearbyOverlayIDs,
|
||||
rayPicks: rayPicks,
|
||||
hudRayPicks: hudRayPicks
|
||||
hudRayPicks: hudRayPicks,
|
||||
mouseRayPick: mouseRayPick
|
||||
};
|
||||
if (PROFILE) {
|
||||
Script.endProfileRange("dispatch.gather");
|
||||
|
@ -390,6 +392,11 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
maxDistance: DEFAULT_SEARCH_SPHERE_DISTANCE,
|
||||
posOffset: getGrabPointSphereOffset(Controller.Standard.RightHand, true)
|
||||
});
|
||||
this.mouseRayPick = RayPick.createRayPick({
|
||||
joint: "Mouse",
|
||||
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS,
|
||||
enabled: true
|
||||
});
|
||||
|
||||
this.handleHandMessage = function(channel, message, sender) {
|
||||
var data;
|
||||
|
|
|
@ -58,6 +58,16 @@
|
|||
}
|
||||
};
|
||||
|
||||
this.adjustReticleDepth = function(controllerData) {
|
||||
if (Reticle.isPointingAtSystemOverlay(Reticle.position)) {
|
||||
var reticlePositionOnHUD = HMD.worldPointFromOverlay(Reticle.position);
|
||||
Reticle.depth = Vec3.distance(reticlePositionOnHUD, HMD.position);
|
||||
} else {
|
||||
var APPARENT_MAXIMUM_DEPTH = 100.0;
|
||||
var result = controllerData.mouseRayPick;
|
||||
Reticle.depth = result.intersects ? result.distance : APPARENT_MAXIMUM_DEPTH;
|
||||
}
|
||||
}
|
||||
this.ignoreMouseActivity = function() {
|
||||
if (!Reticle.allowMouseCapture) {
|
||||
return true;
|
||||
|
@ -98,7 +108,7 @@
|
|||
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
||||
}
|
||||
if (HMD.active) {
|
||||
Reticle.visble = false;
|
||||
Reticle.visible = false;
|
||||
}
|
||||
|
||||
return ControllerDispatcherUtils.makeRunningValues(false, [], []);
|
||||
|
@ -110,6 +120,7 @@
|
|||
Reticle.visible = false;
|
||||
return ControllerDispatcherUtils.makeRunningValues(false, [], []);
|
||||
}
|
||||
this.adjustReticleDepth(controllerData);
|
||||
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue