title: In unity, set transform.forward cause transform.position change
body: <p>I set transform.forward perfect in horizontal move, but when i use it in vertical move, see my gif, <code>transform.forward = newForward</code> will cause transform.position change, <strong>how to make character forward but don't change transform.position</strong></p>
  
  <p><a href="https://i.stack.imgur.com/IKGWq.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IKGWq.gif" alt="enter image description here"></a></p>
  
  <p>here is my full script:</p>
  
  <pre><code>public class TestVerticalMoveForward : MonoBehaviour
  {
      private GameObject from;
  
      private GameObject to;
      private GameObject target;
  
      // Use this for initialization
      void Start()
      {
          from = GameObject.Find("From");
          to = GameObject.Find("To");
          target = from;
      }
  
      private float speed = 10;
  
      // Update is called once per frame
      void Update()
      {
          var offset = target.transform.position - transform.position;
          var forward = offset.normalized;
          var offset2 = speed * Time.deltaTime * forward;
          if (offset.magnitude &lt;= offset2.magnitude)
          {
              transform.position = target.transform.position;
              if (target == to)
              {
                  target = from;
              }
              else
              {
                  target = to;
              }
          }
          else
          {
              transform.position += offset2;
          }
  
          if (offset != Vector3.zero)
          {
              transform.forward = offset;
          }
      }
  }
  </code></pre>