So I’m trying to make camera rotate smoothly back to its’ original position & not wait a whole turn around the object before it does this. Here’s current functions
private float currentLerpTime = 0.0f;
private Quaternion cameraDefaultRotation;
void Start ( ) {
cameraDefaultRotation = cam.transform.rotation;
}
private void ActivateSpringLook ( bool activateSpringLook, Vector3 position, Quaternion rotation ) {
currentLerpTime += Time.deltaTime;
if ( activateSpringLook == true ) {
if ( Input.GetMouseButton ( 0 ) ) {
// The below 2 lines do not work as they wait 1 full rotation before spring looking
// back to original rotation
// xDeg = Mathf.MoveTowards ( xDeg % 360.0f, 0.0f, springLookXSpeed );
// yDeg = Mathf.MoveTowards ( yDeg % 360.0f, 0.0f, springLookYSpeed );
cam.transform.rotation = Quaternion.Slerp (
rotation,
cameraDefaultRotation,
currentLerpTime / 1.0f
);
}
if ( Input.GetMouseButtonUp ( 0 ) ) {
currentLerpTime = 0.0f;
}
}
}
Please note, ActivateSpringLook ( ) is called in the Update ( ) function
Any help is IMMENSELY appreciated!
Thanks alot!
Have a GREAT day!