title: Am trying to create a 3d compass in unity, but the needle fails to rotate along with the body of the compass
body: <p>Am trying to create a 3d compass in unity, but the needle fails to rotate/tilt along with the body of the compass. The needle points accurately towards the north &quot;empty gameobject&quot;. But the only problem is it fails to tilt/rotate(up or down) along with the compass body. Below is d script</p>
  <pre><code>    public class AmpCompass : ResetObject
  {
      public Transform target, compassNeedle;
      public float speed = 1.0f;
      private void Start() {
          
      }
  
      protected override void ObjectIsGrabbed()
      {        
          base.ObjectIsGrabbed();
      } 
  
      private void Update() 
      {
  
          Vector3 needleDir = new Vector3(target.position.x, compassNeedle.position.y, target.position.z);
          compassNeedle.LookAt(needleDir);
      }   
  }
  </code></pre>