ソースを参照

Fix ray-sphere intersection

Daniele Bartolini 10 年 前
コミット
b4f4ae2611
1 ファイル変更1 行追加1 行削除
  1. 1 1
      src/core/math/intersection.cpp

+ 1 - 1
src/core/math/intersection.cpp

@@ -44,7 +44,7 @@ float ray_sphere_intersection(const Vector3& from, const Vector3& dir, const Sph
 	const float b   = dot(v, dir);
 	const float rr  = s.r * s.r;
 	const float bb  = b * b;
-	const float det = rr - dot(v, v) + b;
+	const float det = rr - dot(v, v) + bb;
 
 	if (det < 0.0f || b < s.r)
 		return -1.0f;