I’ve looked at every example I can find and still don’t get it. I have two default camera views that I want to switch between when the user clicks a button. Click once – go to view 1, click again – go to view 2, click again – go to view 1, and so on. A simple toggle that smoothly moves the camera to one of two positions. I’ve ended up with a pretty simple LateUpdate function that just Slerp’s the position and rotation, much like the examples I’ve seen.
I’ve been able to get the camera to move smoothly the first time, but after that the camera just jumps to the end position. For each position I have a start position and rotation, and an end position/rotation. Depending on the state of the button, the start and end swap.
Some things I don’t understand:
How do you know when the camera reaches its end position? I tried comparing the camera’s current position/rotation with the end position/rotation, but that’s never true.
How do you disable the LateUpdate function after the camera has reached its end position? I tried GetComponent(“CameraControl”).enabled = false (and several other variations), but can’t get it to compile. I can’t get it to stop calling the LateUpdate function when the camera doesn’t need to move.
I don’t understand how the time parameter works. All the examples use deltaTime, but if I use that the camera just shakes and never goes anywhere. The only time parameter I can get to work is (Time.time * someValue).