Better collisions
This commit is contained in:
parent
9a40ee07b7
commit
f18310ed5b
@ -15,9 +15,9 @@ class Entity(object):
|
|||||||
self.solid = False
|
self.solid = False
|
||||||
self.movable = False # False = Non movable, True = Movable, x>1: lighter movable
|
self.movable = False # False = Non movable, True = Movable, x>1: lighter movable
|
||||||
self.elasticity = 1
|
self.elasticity = 1
|
||||||
self.collision_changes_speed = False
|
self.collision_changes_speed = True
|
||||||
self._crash_list = []
|
self._crash_list = []
|
||||||
self._coll_add_pushback = 0.05
|
self._coll_add_pushback = 0
|
||||||
|
|
||||||
def physics_step(self):
|
def physics_step(self):
|
||||||
x, y = self.pos
|
x, y = self.pos
|
||||||
|
@ -563,7 +563,10 @@ def parseObs(obsConf):
|
|||||||
obs = []
|
obs = []
|
||||||
for i, c in enumerate(obsConf):
|
for i, c in enumerate(obsConf):
|
||||||
obs.append(parseObs(c))
|
obs.append(parseObs(c))
|
||||||
return observables.CompositionalObservable(obs)
|
if len(obs) == 1:
|
||||||
|
return obs[0]
|
||||||
|
else:
|
||||||
|
return observables.CompositionalObservable(obs)
|
||||||
|
|
||||||
if obsConf['type'] == 'State':
|
if obsConf['type'] == 'State':
|
||||||
conf = {k: v for k, v in obsConf.items() if k not in ['type']}
|
conf = {k: v for k, v in obsConf.items() if k not in ['type']}
|
||||||
|
@ -9,18 +9,17 @@ import torch as th
|
|||||||
class Observable():
|
class Observable():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.obs = None
|
self.obs = None
|
||||||
pass
|
|
||||||
|
|
||||||
def _set_env(self, env):
|
def _set_env(self, env):
|
||||||
self.env = env
|
self.env = env
|
||||||
|
|
||||||
def get_observation_space():
|
def get_observation_space():
|
||||||
print("[!] Using dummyObservable. Env won't output anything")
|
print("[!] Using dummyObservable. Env won't output anything")
|
||||||
return spaces.Box(low=0, high=255,
|
return spaces.Box(low=0, high=1,
|
||||||
shape=(1,), dtype=np.uint8)
|
shape=(1,), dtype=np.float32)
|
||||||
|
|
||||||
def get_observation(self):
|
def get_observation(self):
|
||||||
return False
|
return np.array([0])
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user