This is my first question here. I’m a beginner programmer, just been thrown into it at work. Im actually just a 3D modeller, but anyway.
I’ve got a situation where I have set up a camera with a look at script that moves and changes depending on which object the user presses. Works fine but now i have been asked to make it so you can look around once from that camera point.
This is what i have tried, script is applied to the camera.
It will never finish because you use Slerp as a “divide-remaining-distance” smoothing function. Slerp is usually ment to linearly interpolate a rotation froma constant start rotation to a constant target rotation. The t-parameter has to be moved from 0 to 1. 0 means start rotation 1 means end rotation a value in between will return the respective linear interpolated rotation. Since your t value never reaches 1.0 you will never reach the end. The difference between your current / start rotation and the target rotation will get incredible small, but you will not reach the end.
You can check the Angle between your current rotation and your target rotation and if it’s smaller than for example 1° you can treat it as finished.