Take the position in the last frame and the position in the current frame. Cast a ray from the old position to the new one. If that ray hits a wall, then you know the ball has travelled passed the wall.
↧