I know that questions to do with smooth transitions come up quite frequently, and I have read KurtDekkers helpful guide to them from here - SmoothMovement.cs · GitHub.
But even with that I cannot seem to get this to work, I would greatly appreciate if someone could tell me what I am doing wrong. What I am trying to achieve is when the player lets go of the aim button the crosshair smoothly returns to a postion parallel to the ground. During Start I set the position that I want the camera to return to, then in an “if” statement in Update I set the position that the camera has to move from and attempt to cause the transition. But nothing happens, I imagine my syntax is wrong, but I am not sure! Tahnk you in advance for any and all help! Here are the relevant parts of my code -
Quaternion startAngle;
Quaternion currentAngle;
void Start()
{
Quaternion startAngle = Quaternion.Euler(0, 0, 0);
}
void Update()
{ if (Input.GetKeyUp(KeyCode.LeftShift))
{currentAngle = CameraController.instance.target.transform.localRotation;
CameraController.instance.target.transform.localRotation = Quaternion.Lerp(currentAngle, startAngle, aimSpeed * Time.deltaTime);
}