fix for bug involving probe order
This commit is contained in:
parent
ba700ba633
commit
bd1d861971
10
robot.go
10
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
|
||||
|
Loading…
Reference in New Issue
Block a user