title: Vector3.Lerp inside a Coroutine is not working as it should on Unity3D
body: <p>I am having a strange issue when using a <code>Vector3.Lerp</code> inside a coroutine and it makes no sense because I have many Coroutines in my game and they are all working fine.</p>
  <h2><strong>WHAT I AM TRYING TO ACHIEVE</strong></h2>
  <p>I am simply trying to move an object from a <strong>starting</strong> height to a <strong>final</strong> height with a  coroutine called <code>InVolo()</code> and a simple <code>Vector3.Lerp</code> to change the position of the object.</p>
  <h2><strong>MY CODE</strong></h2>
  <pre><code>float elapsedTime = 0f;
  
      while (elapsedTime &lt; TempoSalita)
      {
  
  
          transform.position = Vector3.Lerp(transform.position, 
              new Vector3(transform.position.x, maxHight, transform.position.z), (elapsedTime / TempoSalita));
  
  
          elapsedTime += Time.deltaTime;
  
          yield return null;
      }
  
      transform.position = new Vector3(transform.position.x, maxHight, transform.position.z);
      yield return null;
  </code></pre>
  <p>The <code>maxHight</code> is simply 4f and <code>TempoSalita</code> is 2f. The coroutine is started in an <strong>OnTriggerEnter</strong> and it is working fine, the object is reaching the y of 4f and it exits the while in 2 seconds.</p>
  <h2><strong>THE PROBLEM</strong></h2>
  <p>Basically, <code>elapsedTime / TempoSalita</code> is becoming <strong>1</strong> after 2 seconds, as it should be, but the object reaches the ending position after like 0.3 seconds, when <code>elapsed/TempoSalita</code> is 0.2 and it makes no sense to me. Vector3.Lerp should go from <strong>startpos</strong> to <strong>endpos</strong> in the time of the <strong>t</strong> value to go from 0 to 1. But it goes to the final position in 0.2 seconds and I don't have a clue why.</p>
  <h2><strong>WHAT I TRIED</strong></h2>
  <p>I have tried to <code>Debug.Log</code> the elapsedTime and it is changing fine, tried to use only <code>Mathf.Lerp</code> between the y values and it does the same thing. There is nothing else in that script that can affect it, this is how the Coroutine starts:</p>
  <pre><code> void OnTriggerEnter(Collider other)
  {
      if(other.CompareTag(&quot;Saltino&quot;))
      {
          StartCoroutine(InVolo());
          
      }
  }
  </code></pre>
  <p>It starts only one time. Do you know what can cause this strange problem?</p>