Good day to you fellow humans,
Im a little puzzled by the following and wish to seek the assistance of someone cleverer than myself. I would like to reset a to.rotation after slerping to the current transform.rotation to avoid continuing the previous slerp the next time the code is called.
This is the relevant part, works fine:
if (Input.GetMouseButton (0)) {
rotationX += Input.GetAxis ("Mouse X") * cameraSensitivity * Time.deltaTime;
rotationY += Input.GetAxis ("Mouse Y") * cameraSensitivity * Time.deltaTime;
rotationY = Mathf.Clamp (rotationY, -90, 90);
Rotat = Quaternion.AngleAxis (rotationX, Vector3.up);
Rotat *= Quaternion.AngleAxis (rotationY, Vector3.left);
transform.rotation = Quaternion.Slerp (transform.rotation, Rotat, Time.deltaTime * LookDamping);
}
Now i would have thought that adding this…
if (Input.GetMouseButtonUp (0)) {
Rotat = transform.rotation;
}
…would stop the camera rolling on to the previous target rotation the next time the button is clicked, but it doesnt seem to do anything.
Any thoughts?