From 5cd9bd394cabd3c2b9d865734f68f7b3d038e526 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Thu, 25 Aug 2022 13:39:11 +0200 Subject: [PATCH] Elasticity of collisions is now configurable --- columbus/entities.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/columbus/entities.py b/columbus/entities.py index bd9bbbe..38d953b 100644 --- a/columbus/entities.py +++ b/columbus/entities.py @@ -15,7 +15,9 @@ class Entity(object): self.solid = False self.movable = False # False = Non movable, True = Movable, x>1: lighter movable self.elasticity = 1 - self.collision_changes_speed = True + #self.collision_changes_speed = True + self.collision_changes_speed = self.env.controll_type == 'ACC' + self.collision_elasticity = self.env.default_collision_elasticity self._crash_list = [] self._coll_add_pushback = 0 @@ -80,8 +82,8 @@ class Entity(object): self._coll_add_pushback*self.env.speed_fac if self.collision_changes_speed: self.speed = self.speed[0] + \ - force_vec[0]/self.env.speed_fac, self.speed[1] + \ - force_vec[1]/self.env.speed_fac + force_vec[0]*self.collision_elasticity/self.env.speed_fac, self.speed[1] + \ + force_vec[1]*self.collision_elasticity/self.env.speed_fac def on_collect(self, other): pass