Minor tweak
This commit is contained in:
parent
e6a737e8d6
commit
10a007e044
@ -242,13 +242,14 @@ public class ProximityHider extends Thread implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean fastAABBRayCheck(double bx, double by, double bz, double x, double y, double z, double ex, double ey, double ez, World world) {
|
private boolean fastAABBRayCheck(double bx, double by, double bz, double x, double y, double z, double ex, double ey, double ez, World world) {
|
||||||
boolean dx = ex > x;
|
double fx = ex - x;
|
||||||
boolean dy = ey > y;
|
double fy = ey - y;
|
||||||
boolean dz = ez > z;
|
double fz = ez - z;
|
||||||
double fx = Math.abs(ex-x);
|
double absFx = Math.abs(fx);
|
||||||
double fy = Math.abs(ey-y);
|
double absFy = Math.abs(fy);
|
||||||
double fz = Math.abs(ez-z);
|
double absFz = Math.abs(fz);
|
||||||
double s = Math.max(fx, Math.max(fy, fz));
|
double s = Math.max(absFx, Math.max(absFy, absFz));
|
||||||
|
|
||||||
if (s < 1) return true; // on top / inside
|
if (s < 1) return true; // on top / inside
|
||||||
|
|
||||||
double lx, ly, lz;
|
double lx, ly, lz;
|
||||||
@ -258,9 +259,9 @@ public class ProximityHider extends Thread implements Runnable {
|
|||||||
fz = fz / s;
|
fz = fz / s;
|
||||||
|
|
||||||
while (s > 0) {
|
while (s > 0) {
|
||||||
ex = dx ? ex - fx : ex + fx; // move along vector, we start _at_ the eye and move towards b
|
ex = ex - fx; // move along vector, we start _at_ the eye and move towards b
|
||||||
ey = dy ? ey - fy : ey + fy;
|
ey = ey - fy;
|
||||||
ez = dz ? ez - fz : ez + fz;
|
ez = ez - fz;
|
||||||
lx = Math.floor(ex);
|
lx = Math.floor(ex);
|
||||||
ly = Math.floor(ey);
|
ly = Math.floor(ey);
|
||||||
lz = Math.floor(ez);
|
lz = Math.floor(ez);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user