From e1a1522269c6bb7db81294c080bf2f91b796d5bc Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Thu, 4 Aug 2022 14:30:07 -0500 Subject: [PATCH] Correctly calculate direction and distance with yaws. --- src/core.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core.rs b/src/core.rs index ac8755e..2e1c2a7 100644 --- a/src/core.rs +++ b/src/core.rs @@ -493,15 +493,13 @@ impl GlobalTransformExt for GlobalTransform { ) -> String { use bevy::math::Vec3Swizzles; let scale = PHYSICS_SCALE.read().unwrap(); - let (_, rotation, _) = self.to_scale_rotation_translation(); let pos1 = Isometry::new( (self.translation() / *scale).xy().into(), - rotation.to_scaled_axis().z, + self.yaw().radians(), ); - let (_, other_rotation, _) = self.to_scale_rotation_translation(); let pos2 = Isometry::new( (other.translation() / *scale).xy().into(), - other_rotation.to_scaled_axis().z, + other.yaw().radians(), ); let closest = closest_points(&pos1, &*collider.raw, &pos2, &*other_collider.raw, f32::MAX).unwrap();