I have the following relevant code for modelling the trajectory of a racquetball inside of a box:
while t<20: if ball.pos.x>wallR.pos.x-ball.radius: