title: Move an object up/down slowly in Unity?
body: <p>I am trying to move my object up and down (Y-axis) slowly, it works but unfortunately the object starts moving up/down from a different position. How do I make sure that it starts moving up and down from a given position say Y=10.25f?</p>
  
  <pre><code>float speed = 2f;
  float height = 0.05f;
  
  void Update()
  {
      Vector3 pos = transform.position;
  
      float newY = Mathf.Sin(Time.time * speed);
  
      newY = newY*height;
  
      transform.position = new Vector3(pos.x, newY, pos.z);
  }
  </code></pre>