added collision detection with the ground