Compare commits

..

No commits in common. "5e700a74b0206edd5e1da7edd3f44f5ba210f8d9" and "07e745c3fc4457abc2eea8cabfbec5b4ddaeb2f2" have entirely different histories.

View File

@ -471,14 +471,6 @@ impl From<&dyn PointLike> for (i32, i32) {
pub trait GlobalTransformExt { pub trait GlobalTransformExt {
fn yaw(&self) -> Angle; fn yaw(&self) -> Angle;
fn closest_points(
&self,
collider: &Collider,
other: &GlobalTransform,
other_collider: &Collider,
) -> ClosestPoints;
fn collider_direction_and_distance( fn collider_direction_and_distance(
&self, &self,
collider: &Collider, collider: &Collider,
@ -493,25 +485,6 @@ impl GlobalTransformExt for GlobalTransform {
Angle::Radians(forward.y.atan2(forward.x)) Angle::Radians(forward.y.atan2(forward.x))
} }
fn closest_points(
&self,
collider: &Collider,
other: &GlobalTransform,
other_collider: &Collider,
) -> ClosestPoints {
use bevy::math::Vec3Swizzles;
let scale = PHYSICS_SCALE.read().unwrap();
let pos1 = Isometry::new(
(self.translation() / *scale).xy().into(),
self.yaw().radians(),
);
let pos2 = Isometry::new(
(other.translation() / *scale).xy().into(),
other.yaw().radians(),
);
closest_points(&pos1, &*collider.raw, &pos2, &*other_collider.raw, f32::MAX).unwrap()
}
fn collider_direction_and_distance( fn collider_direction_and_distance(
&self, &self,
collider: &Collider, collider: &Collider,
@ -528,7 +501,8 @@ impl GlobalTransformExt for GlobalTransform {
(other.translation() / *scale).xy().into(), (other.translation() / *scale).xy().into(),
other.yaw().radians(), other.yaw().radians(),
); );
let closest = self.closest_points(collider, other, other_collider); let closest =
closest_points(&pos1, &*collider.raw, &pos2, &*other_collider.raw, f32::MAX).unwrap();
let distance = distance(&pos1, &*collider.raw, &pos2, &*other_collider.raw).unwrap() as u32; let distance = distance(&pos1, &*collider.raw, &pos2, &*other_collider.raw).unwrap() as u32;
let tile_or_tiles = if distance == 1 { "tile" } else { "tiles" }; let tile_or_tiles = if distance == 1 { "tile" } else { "tiles" };
if distance > 0 { if distance > 0 {