mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 19:55:07 +02:00
Fixed bug in rayPlane test
This commit is contained in:
parent
e9aed83920
commit
cee79c8274
2 changed files with 8 additions and 4 deletions
|
@ -728,9 +728,10 @@ function rayPlaneIntersection2(pickRay, point, normal) {
|
|||
// This version of the test returns false if the ray is directed away from the plane
|
||||
//
|
||||
var collides = Vec3.dot(pickRay.direction, normal);
|
||||
if (collides > 0.0) return false;
|
||||
|
||||
var d = -Vec3.dot(point, normal);
|
||||
if (((collides > 0.0) && (d > 0.0)) || ((collides < 0.0) && (d < 0.0))) {
|
||||
return false;
|
||||
}
|
||||
var t = -(Vec3.dot(pickRay.origin, normal) + d) / collides;
|
||||
|
||||
return Vec3.sum(pickRay.origin, Vec3.multiply(pickRay.direction, t));
|
||||
|
|
|
@ -2334,10 +2334,13 @@ SelectionDisplay = (function() {
|
|||
// If the mouse is too close to the horizon of the pick plane, stop moving
|
||||
var MIN_AZIMUTH = 0.02; // Radians
|
||||
var azimuth = translateXZTool.azimuth(pickRay.origin, pick);
|
||||
if (wantDebug) {
|
||||
print("Start Azimuth: " + translateXZTool.startingAzimuth + ", Azimuth: " + azimuth);
|
||||
}
|
||||
if ((translateXZTool.startingAzimuth > 0.0 && azimuth < MIN_AZIMUTH) ||
|
||||
(translateXZTool.startingAzimuth < 0.0 && azimuth > MIN_AZIMUTH)) {
|
||||
(translateXZTool.startingAzimuth < 0.0 && azimuth > -MIN_AZIMUTH)) {
|
||||
if (wantDebug) {
|
||||
print("Azimuth = " + azimuth);
|
||||
print("too close to horizon!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue