Tweaked collision physics

This commit is contained in:
Dominik Moritz Roth 2022-08-27 12:15:28 +02:00
parent 1c654fcf81
commit aa6ab1dca6

View File

@ -75,7 +75,9 @@ class Entity(object):
depth /= other.elasticity
force_vec = force_dir[0]*depth/self.env.width, \
force_dir[1]*depth/self.env.height
if sum([abs(f) for f in force_vec]) > 0.005:
self.pos = self.pos[0] + force_vec[0], self.pos[1] + force_vec[1]
print('#########################')
if self._coll_add_pushback:
self.pos = self.pos[0] - self.env.inp[0]*self._coll_add_pushback * \
self.env.speed_fac, self.pos[1] - self.env.inp[1] * \