From bd1d861971600d7430c94b728fc43ad00a22acfb Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Sat, 26 Apr 2014 15:15:14 -0700 Subject: [PATCH] fix for bug involving probe order --- robot.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/robot.go b/robot.go index 18f9c35..63da1bc 100644 --- a/robot.go +++ b/robot.go @@ -220,6 +220,16 @@ func (r *Robot) checkCollisions(g *Game, probe v.Vector2d) (bool, *v.Point2d, *R closest = dist } } + + // collision due to probe + collision, _, wallIntersect := v.RectIntersection(obj.Bounds, r.Position, probe) + if collision && wallIntersect != nil { + finalCollision = collision + if dist := r.Position.Sub(*wallIntersect).Mag(); dist < closest { + intersection = wallIntersect + closest = dist + } + } } // Check Other Bots