Ver código fonte

Ray: Clean up (#25524)

* Ray: Clean up

* Don't move t0

* Update Ray.js

---------

Co-authored-by: mrdoob <[email protected]>
Levi Pesin 2 anos atrás
pai
commit
90e4e6caee
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      src/math/Ray.js

+ 2 - 2
src/math/Ray.js

@@ -234,8 +234,8 @@ class Ray {
 		// t1 = second intersect point - exit point on back of sphere
 		// t1 = second intersect point - exit point on back of sphere
 		const t1 = tca + thc;
 		const t1 = tca + thc;
 
 
-		// test to see if both t0 and t1 are behind the ray - if so, return null
-		if ( t0 < 0 && t1 < 0 ) return null;
+		// test to see if t1 is behind the ray - if so, return null
+		if ( t1 < 0 ) return null;
 
 
 		// test to see if t0 is behind the ray:
 		// test to see if t0 is behind the ray:
 		// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
 		// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,