diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index 88c9b152ee..a6ae8bfedf 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -1942,14 +1942,13 @@ fn projection_between(c0: ColliderContext, c1: ColliderContext) -> (Vec2, f // of motion from our target collider to our collider. // // TODO: can code beloew be deduplicated? :think: + let we = c0.pos.xy(); + let other = c1.pos.xy(); if c0.previous_cache.scaled_radius > c1.previous_cache.scaled_radius { let our_radius = c0.previous_cache.neighborhood_radius; let their_radius = c1.previous_cache.scaled_radius; let collision_dist = our_radius + their_radius; - let we = c0.pos.xy(); - let other = c1.pos.xy(); - let (p0_offset, p1_offset) = match c0.previous_cache.origins { Some(origins) => origins, None => return (we - other, collision_dist), @@ -1959,7 +1958,7 @@ fn projection_between(c0: ColliderContext, c1: ColliderContext) -> (Vec2, f end: we + p1_offset, }; - let projection = other - segment.projected_point(other) - other; + let projection = segment.projected_point(other) - other; (projection, collision_dist) } else { @@ -1967,9 +1966,6 @@ fn projection_between(c0: ColliderContext, c1: ColliderContext) -> (Vec2, f let their_radius = c1.previous_cache.neighborhood_radius; let collision_dist = our_radius + their_radius; - let we = c0.pos.xy(); - let other = c1.pos.xy(); - let (p0_offset_other, p1_offset_other) = match c1.previous_cache.origins { Some(origins) => origins, None => return (we - other, collision_dist),