Tweaked collision physics
This commit is contained in:
parent
1c654fcf81
commit
aa6ab1dca6
@ -75,7 +75,9 @@ class Entity(object):
|
|||||||
depth /= other.elasticity
|
depth /= other.elasticity
|
||||||
force_vec = force_dir[0]*depth/self.env.width, \
|
force_vec = force_dir[0]*depth/self.env.width, \
|
||||||
force_dir[1]*depth/self.env.height
|
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]
|
self.pos = self.pos[0] + force_vec[0], self.pos[1] + force_vec[1]
|
||||||
|
print('#########################')
|
||||||
if self._coll_add_pushback:
|
if self._coll_add_pushback:
|
||||||
self.pos = self.pos[0] - self.env.inp[0]*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] * \
|
self.env.speed_fac, self.pos[1] - self.env.inp[1] * \
|
||||||
|
Loading…
Reference in New Issue
Block a user