touch function for box and sphere