From 52e0047bff140f5fa261d5b42e9c12d5b98888da Mon Sep 17 00:00:00 2001 From: atlas dostal Date: Thu, 31 Jul 2025 19:34:27 -0400 Subject: [PATCH] the inverse of a rotation matrix is its transpose --- crates/bevy_light/src/cascade.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_light/src/cascade.rs b/crates/bevy_light/src/cascade.rs index 0cb713a9e684c..ba4c615b06007 100644 --- a/crates/bevy_light/src/cascade.rs +++ b/crates/bevy_light/src/cascade.rs @@ -225,8 +225,8 @@ pub fn build_directional_light_cascades( // users to not change any other aspects of the transform - there's no guarantee // `transform.to_matrix()` will give us a matrix with our desired properties. // Instead, we directly create a good matrix from just the rotation. - let world_from_light = Mat4::from_quat(transform.compute_transform().rotation); - let light_to_world_inverse = world_from_light.inverse(); + let world_from_light = Mat4::from_quat(transform.rotation()); + let light_to_world_inverse = world_from_light.transpose(); for (view_entity, projection, view_to_world) in views.iter().copied() { let camera_to_light_view = light_to_world_inverse * view_to_world;