mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +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.leftControllerHudRayPick),
|
||||||
RayPick.getPrevRayPickResult(_this.rightControllerHudRayPick)
|
RayPick.getPrevRayPickResult(_this.rightControllerHudRayPick)
|
||||||
];
|
];
|
||||||
|
var mouseRayPick = RayPick.getPrevRayPickResult(_this.mouseRayPick);
|
||||||
// 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++) {
|
||||||
|
|
||||||
|
@ -274,7 +275,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
nearbyEntityPropertiesByID: nearbyEntityPropertiesByID,
|
nearbyEntityPropertiesByID: nearbyEntityPropertiesByID,
|
||||||
nearbyOverlayIDs: nearbyOverlayIDs,
|
nearbyOverlayIDs: nearbyOverlayIDs,
|
||||||
rayPicks: rayPicks,
|
rayPicks: rayPicks,
|
||||||
hudRayPicks: hudRayPicks
|
hudRayPicks: hudRayPicks,
|
||||||
|
mouseRayPick: mouseRayPick
|
||||||
};
|
};
|
||||||
if (PROFILE) {
|
if (PROFILE) {
|
||||||
Script.endProfileRange("dispatch.gather");
|
Script.endProfileRange("dispatch.gather");
|
||||||
|
@ -390,6 +392,11 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
maxDistance: DEFAULT_SEARCH_SPHERE_DISTANCE,
|
maxDistance: DEFAULT_SEARCH_SPHERE_DISTANCE,
|
||||||
posOffset: getGrabPointSphereOffset(Controller.Standard.RightHand, true)
|
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) {
|
this.handleHandMessage = function(channel, message, sender) {
|
||||||
var data;
|
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() {
|
this.ignoreMouseActivity = function() {
|
||||||
if (!Reticle.allowMouseCapture) {
|
if (!Reticle.allowMouseCapture) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -98,7 +108,7 @@
|
||||||
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
||||||
}
|
}
|
||||||
if (HMD.active) {
|
if (HMD.active) {
|
||||||
Reticle.visble = false;
|
Reticle.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ControllerDispatcherUtils.makeRunningValues(false, [], []);
|
return ControllerDispatcherUtils.makeRunningValues(false, [], []);
|
||||||
|
@ -110,6 +120,7 @@
|
||||||
Reticle.visible = false;
|
Reticle.visible = false;
|
||||||
return ControllerDispatcherUtils.makeRunningValues(false, [], []);
|
return ControllerDispatcherUtils.makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
this.adjustReticleDepth(controllerData);
|
||||||
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
return ControllerDispatcherUtils.makeRunningValues(true, [], []);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue