title: Function to determine when a sphere is touching floor 3d
body: <p>I am trying to get a sphere to make contact with the floor. The spheres radius is 1.0f - I need to work out how to determine the distance between the sphere and the floor. </p>
  
  <p>The Sphere is placed here</p>
  
  <pre><code>glm::mat4 mv_matrix_sphere =
      glm::translate(glm::vec3(-2.0f, y, 0.0f)) *
      glm::rotate(-t, glm::vec3(0.0f, 1.0f, 0.0f)) *
      glm::rotate(-t, glm::vec3(1.0f, 0.0f, 0.0f)) *
      glm::mat4(1.0f);
  mySphere.mv_matrix = myGraphics.viewMatrix * mv_matrix_sphere;
  mySphere.proj_matrix = myGraphics.proj_matrix;
  </code></pre>
  
  <p>Where y = 20.0f </p>
  
  <p>The sphere will fall and land on the floor at</p>
  
  <pre><code>myFloor.mv_matrix = myGraphics.viewMatrix *
      glm::translate(glm::vec3(0.0f, 0.0f, 0.0f)) *
      glm::scale(glm::vec3(1000.0f, 0.001f, 1000.0f)) *
      glm::mat4(1.0f);
  myFloor.proj_matrix = myGraphics.proj_matrix;
  </code></pre>
  
  <p>The function I need will work out when the Sphere is 1.0f(radius) from the floor so that it collides with it instead of clipping through.</p>