summary refs log tree commit diff
path: root/src/Math/Ray.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Math/Ray.hpp')
-rw-r--r--src/Math/Ray.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Math/Ray.hpp b/src/Math/Ray.hpp
index db37ac2..4050a02 100644
--- a/src/Math/Ray.hpp
+++ b/src/Math/Ray.hpp
@@ -15,6 +15,8 @@ struct Ray {
     // [1]: https://gdbooks.gitbooks.io/3dcollisions/content/Chapter3/raycast_aabb.html
     // [2]: https://tavianator.com/2015/ray_box_nan.html
     RaycastResult cast(AABB box, Real max_distance = 0) const {
+        if (direction.is_zero()) return {};
+
         RaycastResult hit{ true };
 
         // `t` is the time at which the ray intersects a plane of the AABB.