diff --git a/crates/bevy_math/src/ray.rs b/crates/bevy_math/src/ray.rs index 1f260f63c9..eb3559b206 100644 --- a/crates/bevy_math/src/ray.rs +++ b/crates/bevy_math/src/ray.rs @@ -252,21 +252,20 @@ mod tests { let ray = Ray3d::new(Vec3::ZERO, Dir3::Z); // Orthogonal, and test that ray intersects only the front face - assert_eq!( + assert!( ray.intersect_plane( Vec3::Z, InfinitePlane3d::new(Vec3::Z), PlaneIntersectionMode::FrontFaceOnly - ), - Some(1.0) - ); - assert!(ray + ) + .is_none()); + assert_eq!(ray .intersect_plane( Vec3::Z, InfinitePlane3d::new(Vec3::NEG_Z), PlaneIntersectionMode::FrontFaceOnly - ) - .is_none()); + ), + Some(1.0)); assert!(ray .intersect_plane( Vec3::NEG_Z, @@ -277,7 +276,7 @@ mod tests { assert!(ray .intersect_plane( Vec3::NEG_Z, - InfinitePlane3d::new(Vec3::Z), + InfinitePlane3d::new(Vec3::NEG_Z), PlaneIntersectionMode::FrontFaceOnly ) .is_none()); @@ -288,13 +287,6 @@ mod tests { let ray = Ray3d::new(Vec3::ZERO, Dir3::Z); // Orthogonal, and test that ray intersects only the back face - assert!(ray - .intersect_plane( - Vec3::Z, - InfinitePlane3d::new(Vec3::Z), - PlaneIntersectionMode::BackFaceOnly - ) - .is_none()); assert_eq!( ray.intersect_plane( Vec3::Z, @@ -305,8 +297,8 @@ mod tests { ); assert!(ray .intersect_plane( - Vec3::NEG_Z, - InfinitePlane3d::new(Vec3::Z), + Vec3::Z, + InfinitePlane3d::new(Vec3::NEG_Z), PlaneIntersectionMode::BackFaceOnly ) .is_none()); @@ -317,5 +309,12 @@ mod tests { PlaneIntersectionMode::BackFaceOnly ) .is_none()); + assert!(ray + .intersect_plane( + Vec3::NEG_Z, + InfinitePlane3d::new(Vec3::NEG_Z), + PlaneIntersectionMode::BackFaceOnly + ) + .is_none()); } }