From 3e6ee52d3e533f359f306f5a1c2538ff10371c73 Mon Sep 17 00:00:00 2001 From: Sara Date: Wed, 25 Oct 2023 20:24:00 +0200 Subject: [PATCH] moved "no collision" in _internal_collision_get_overlap --- src/collision.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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);