Explorar o código

Ray: Handle empty spheres in `intersectsSphere()`. (#31200)

Michael Herzog hai 7 meses
pai
achega
ea4ecb7498
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/math/Ray.js

+ 2 - 0
src/math/Ray.js

@@ -346,6 +346,8 @@ class Ray {
 	 */
 	 */
 	intersectsSphere( sphere ) {
 	intersectsSphere( sphere ) {
 
 
+		if ( sphere.radius < 0 ) return false; // handle empty spheres, see #31187
+
 		return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );
 		return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );
 
 
 	}
 	}

粤ICP备19079148号