Better collisions

This commit is contained in:
Dominik Moritz Roth 2022-08-20 17:18:03 +02:00
parent 9a40ee07b7
commit f18310ed5b
3 changed files with 9 additions and 7 deletions

View File

@ -15,9 +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 = False
self.collision_changes_speed = True
self._crash_list = []
self._coll_add_pushback = 0.05
self._coll_add_pushback = 0
def physics_step(self):
x, y = self.pos

View File

@ -563,6 +563,9 @@ def parseObs(obsConf):
obs = []
for i, c in enumerate(obsConf):
obs.append(parseObs(c))
if len(obs) == 1:
return obs[0]
else:
return observables.CompositionalObservable(obs)
if obsConf['type'] == 'State':

View File

@ -9,18 +9,17 @@ import torch as th
class Observable():
def __init__(self):
self.obs = None
pass
def _set_env(self, env):
self.env = env
def get_observation_space():
print("[!] Using dummyObservable. Env won't output anything")
return spaces.Box(low=0, high=255,
shape=(1,), dtype=np.uint8)
return spaces.Box(low=0, high=1,
shape=(1,), dtype=np.float32)
def get_observation(self):
return False
return np.array([0])
def draw(self):
pass