fix for bug involving probe order

This commit is contained in:
Stephen McQuay 2014-04-26 15:15:14 -07:00
parent ba700ba633
commit bd1d861971

View File

@ -220,6 +220,16 @@ func (r *Robot) checkCollisions(g *Game, probe v.Vector2d) (bool, *v.Point2d, *R
closest = dist 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 // Check Other Bots