Remove special case wall collisions, replace with generated objects
This commit is contained in:
@@ -195,29 +195,8 @@ func (r *Robot) checkCollisions(g *Game, probe v.Vector2d) (bool, *v.Point2d, *R
|
||||
botSize := 5.0
|
||||
botPolygon := v.OrientedSquare(r.Position, r.Heading, botSize)
|
||||
|
||||
bounds := []Obstacle{
|
||||
Obstacle{
|
||||
Bounds: v.AABB2d{A: v.Point2d{0, 0}, B: v.Point2d{0, g.width}},
|
||||
Hp: 0,
|
||||
},
|
||||
Obstacle{
|
||||
Bounds: v.AABB2d{A: v.Point2d{0, 0}, B: v.Point2d{0, g.height}},
|
||||
Hp: 0,
|
||||
},
|
||||
Obstacle{
|
||||
Bounds: v.AABB2d{A: v.Point2d{g.width, g.height}, B: v.Point2d{0, g.height}},
|
||||
Hp: 0,
|
||||
},
|
||||
Obstacle{
|
||||
Bounds: v.AABB2d{A: v.Point2d{g.width, g.height}, B: v.Point2d{g.width, 0}},
|
||||
Hp: 0,
|
||||
},
|
||||
}
|
||||
|
||||
obstacles := append(g.obstacles, bounds...)
|
||||
|
||||
// Check Obstacles
|
||||
for _, obj := range obstacles {
|
||||
for _, obj := range g.obstacles {
|
||||
// collision due to motion:
|
||||
collision, move_collision, translation := v.PolyPolyIntersection(
|
||||
botPolygon, probe, obj.Bounds.ToPolygon())
|
||||
|
||||
Reference in New Issue
Block a user