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.hpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Math/Ray.hpp b/src/Math/Ray.hpp
index c2c2274..db37ac2 100644
--- a/src/Math/Ray.hpp
+++ b/src/Math/Ray.hpp
@@ -36,9 +36,12 @@ struct Ray {
         // by the ray at the biggest smaller `t` value.
         // Since a plane always has two normals, we know which one to pick by looking
         // at the direction of the ray.
-        hit.normal = smaller_t_values.zip(direction, [=](Real t, Real d) {
-            return Math::floats_equal(t, biggest_min_t) ? Math::sign(d) : 0;
-        });
+        for (U8 a = 0; a < 3; a++) {
+            if (Math::floats_equal(smaller_t_values[a], biggest_min_t)) {
+                hit.normal[a] = Math::sign(direction[a]);
+                break;
+            }
+        }
 
         // If the smallest `t` is negative, the ray is pointing away from the AABB.
         // If the biggest `t` is smaller than the smallest `t`, the ray is missing the AABB,