From 048ba027f36aa8b2414ead1b62716626ec847613 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Tue, 13 Dec 2022 20:13:39 +0100 Subject: [PATCH] Fixed clipping of entities on edge --- columbus/entities.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/columbus/entities.py b/columbus/entities.py index aff568e..1731d5e 100644 --- a/columbus/entities.py +++ b/columbus/entities.py @@ -19,7 +19,7 @@ class Entity(object): self.col = (255, 255, 255) self.solid = False self.movable = False # False = Non movable, True = Movable, x>1: lighter movable - self.void_collidable = True + self.void_collidable = False self.elasticity = 1 self.collision_changes_speed = self.env.controll_type == 'ACC' self.collision_elasticity = self.env.default_collision_elasticity @@ -49,7 +49,7 @@ class Entity(object): if speeds > self.max_speed: vx, vy = vx/speeds*self.max_speed, vy/speeds*self.max_speed x, y = x+vx*self.env.speed_fac, y+vy*self.env.speed_fac - if not self.env.torus_topology: + if not self.env.torus_topology and self.void_collidable: if x > 1 or x < 0: x, y, vx, vy = self.calc_void_collision(x < 0, x, y, vx, vy) if y > 1 or y < 0: @@ -341,6 +341,7 @@ class Agent(CircularEntity): self.controll_type = self.env.controll_type self.solid = True self.movable = True + self.void_collidable = True def controll_step(self): self._read_input()