From 103c4d7ffbeac1d64eef4111f6a01ee36cc2755a Mon Sep 17 00:00:00 2001
From: juliancoffee <lightdarkdaughter@gmail.com>
Date: Thu, 16 Sep 2021 16:53:29 +0300
Subject: [PATCH] Fix bug with zero-pushback for bigger colliders

---
 common/systems/src/phys.rs | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

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<f32>, 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<f32>, 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<f32>, 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),