title: Aim Assist in Unity?
body: <p>Well, I'm working on something, but I'm stuck right now. as Title says it's about an "aim assist" for a shooting game. I move my camera using pitch-yaw updated every frame. like this:</p>
  
  <pre><code>void Update()
  {
      float pitch -= Input.GetAxis("Mouse Y") * sensivity;
      float yaw += Input.GetAxis("Mouse X") * sensivity;
      Vector2 rot = new Vector2(pitch, yaw);
      cam.tranform.eulerAngles = rot;
  }
  </code></pre>
  
  <p>And my AimAssit() method look like this:</p>
  
  <pre><code>void AimAssist(float weaponRange)
  {
      RaycastHit hit;
  
      if (Physics.SphereCast(cam.transform.position, radiusDetection, cam.transform.forward, out hit, weaponRange, 1 &lt;&lt; LayerMask.NameToLayer("Shootable"))
      {
          GameObject aimTo = hit.transform.gameObject;
          Vector3 direction = aimTo.transform.position - cam.transform.position;
          cam.transform.rotation = Quaternion.Slerp(cam.transform.rotation, Quaternion.LookRotation(direction), .1f);
      }
  }
  </code></pre>
  
  <p>So, The problem is they don't work together, it's a mess. I know one of these work with degrees and the other one use angles, it's confusing. In other words, what I need is <s>snap the crosshair in the head</s> and still move fine with mouse. Thanks in advance.</p>
  
  <p>BTW, I made this, but it was useless:</p>
  
  <pre><code> Vector2 aim = new Vector2(Quaternion.LookRotation(direction).eulerAngles.x, Quaternion.LookRotation(direction).eulerAngles.y);
   CamTransform().eulerAngles = currentRotation + (Vector2)aim;
  </code></pre>
  
  <p>To be clear "direction" is the same from AimAssist().</p>