Correctly calculate direction and distance with yaws.
This commit is contained in:
parent
1fcec80e0e
commit
e1a1522269
|
@ -493,15 +493,13 @@ impl GlobalTransformExt for GlobalTransform {
|
||||||
) -> String {
|
) -> String {
|
||||||
use bevy::math::Vec3Swizzles;
|
use bevy::math::Vec3Swizzles;
|
||||||
let scale = PHYSICS_SCALE.read().unwrap();
|
let scale = PHYSICS_SCALE.read().unwrap();
|
||||||
let (_, rotation, _) = self.to_scale_rotation_translation();
|
|
||||||
let pos1 = Isometry::new(
|
let pos1 = Isometry::new(
|
||||||
(self.translation() / *scale).xy().into(),
|
(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(
|
let pos2 = Isometry::new(
|
||||||
(other.translation() / *scale).xy().into(),
|
(other.translation() / *scale).xy().into(),
|
||||||
other_rotation.to_scaled_axis().z,
|
other.yaw().radians(),
|
||||||
);
|
);
|
||||||
let closest =
|
let closest =
|
||||||
closest_points(&pos1, &*collider.raw, &pos2, &*other_collider.raw, f32::MAX).unwrap();
|
closest_points(&pos1, &*collider.raw, &pos2, &*other_collider.raw, f32::MAX).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user