diff --git a/src/collision.c b/src/collision.c index b839036..3a55471 100644 --- a/src/collision.c +++ b/src/collision.c @@ -79,16 +79,14 @@ int _internal_collision_get_overlap(PhysicsEntity self, PhysicsEntity other, Col // the smallest escape vector on this axis Vector escape = _internal_collision_overlap_on_axis(self, other, vnormalizedf(normal), &overlap_point); float sqr_mag = vsqrmagnitudef(escape); + if(sqr_mag == 0) { + return 0; + } if(sqr_mag < shortest_sqrmag) { shortest_sqrmag = sqr_mag; shortest_escape = escape; shortest_escape_edge = point_index; } - - if(sqr_mag == 0) { - out->penetration_vector = InfinityVector; - return 0; - } } RigidBody* rba = self.tc->get_rigidbody(self.data);