The above code works under the following assumption: v*dt<< R, where R is the radius of the ball.
It means that the time step need to be chose properly.