Explorar el Código

raycast division safety - corrects issues with awesomium and the guionobject resources relating to WYSIWYG casts.

Azaezel hace 9 años
padre
commit
c67ba876d0
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      Engine/source/ts/tsCollision.cpp

+ 6 - 1
Engine/source/ts/tsCollision.cpp

@@ -1630,7 +1630,12 @@ bool TSMesh::castRayOpcode( const Point3F &s, const Point3F &e, RayInfo *info, T
          }
 
          // slerp
-         Point3F s = ( (max - min) - (facePoint - min) ) / (max - min);
+         Point3F divSafe = (max - min);
+         if (divSafe.x == 0.0f) divSafe.x = POINT_EPSILON;
+         if (divSafe.y == 0.0f) divSafe.y = POINT_EPSILON;
+         if (divSafe.z == 0.0f) divSafe.z = POINT_EPSILON;
+
+         Point3F s = ( (max - min) - (facePoint - min) ) / divSafe;
 
          // compute axis
          S32		bestAxis = 0;