Fixed a calculation bug while setting the ball position