From a2d8f0c952db99e13c4e7ba9c6ea0b7f97fffa7b Mon Sep 17 00:00:00 2001 From: sayanmitracode <sayan.mitra@gmail.com> Date: Sun, 19 Jun 2022 22:42:30 -0500 Subject: [PATCH] ball collision checks --- demo/ball_bounces.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/demo/ball_bounces.py b/demo/ball_bounces.py index 73e49c23..6c81aebd 100644 --- a/demo/ball_bounces.py +++ b/demo/ball_bounces.py @@ -40,11 +40,18 @@ def controller(ego:State, others:State): output.vy = -ego.vy output.y=0 if ego.x>20: + # Q. If I change this to ego.x >= 20 then the model does not work. + # I suspect this is because the same transition can be take many, many times. + # We need to figure out a clean solution output.vx = -ego.vx output.x=20 if ego.y>20: output.vy = -ego.vy output.y=20 + ''' if ego.x - others[1].x < 1 and ego.y - others[1].y < 1: + output.vy = -ego.vy + output.vx = -ego.vx''' + # We would like to be able to write something like this, but currently not allowed. return output -- GitLab