Help with SmoothDamp in my camera script [FPS]

Hi :slight_smile:
I’m trying to add some smoothness to my camera movement but I don’t know how to do it as I’m still kinda novice.
It’s a first person controller, so I have two scripts here:

Player script:

public class PlayerMovement : MonoBehaviour {
  private static CharacterController _cc;
  private static bool _canMove = true;
  private static float _currentSpeed = 2f;
  private static float _xRot;

  public static float XRot {
    get { return _xRot; } set { _xRot = value; }
  }

  private void Update() {
    float hAxis = Input.GetAxis("Horizontal") * _currentSpeed;
    float vAxis = Input.GetAxis("Vertical") * _currentSpeed;
    Vector3 movement = new Vector3(hAxis, 0f, vAxis);

    movement = transform.rotation * movement;

    if (CameraController.CanMoveCam) {
      _xRot = Input.GetAxis("Mouse X");
      transform.eulerAngles += new Vector3(0f, _xRot, 0f) * CameraController.Sensitivity;
    }

    if (_canMove)
      _cc.Move(movement * Time.deltaTime);
  }
}

Camera script:

public class CameraController : MonoBehaviour {
  private static bool _canMoveCam = true;
  private static float _sensitivity;
  private Transform _cam;
  private float _yRot;

  public static CanMoveCam {
    get { return _canMoveCam; } set { _canMoveCam = value; } 
  }
  public static float Sensitivity {
    get { return _sensitivity; } set { _sensitivity = value; }
  }

  private void Start() {
    _cam = Camera.main.transform;
    _yRot = 0f;
    _sensitivity = 1.5f;
  }

  private void Update() {
    if (_canMoveCam) {
      _yRot -= Input.GetAxis("Mouse Y");
      _yRot = Mathf.Clamp(_yRot, -40f, 40f);

      transform.eulerAngles += new Vector3(0f, PlayerMovement.XRot, 0f) * _sensitivity;
      _cam.localEulerAngles = new Vector3(_yRot, 0f, 0f) * _sensitivity;
    } else {
      PlayerMovement.XRot = transform.eulerAngles.x;
      _yRot = transform.eulerAngles.y;
    }
  }
}

Any suggestions?
Thanks! :roll_eyes:

Smooth what values? Code looks odd to me with the statics and get set stuff. Why is it there? You should be caching references and pointing at them.