Rotate around object smoothly


I am using a modified MouseOrbit script to rotate a camera around an object. It is similar to the one in this thread: Smooth Mouse Orbit - Questions & Answers - Unity Discussions

Now I want to be able to get the camera facing each “90 degree side” of the object by pressing the right or left arrow. If the camera is between two sides it rotates to the next one.

My problem is that if I want it to look smooth (and relatively fast), it overshoots the given value. It only works without the smooth because it stops immediately at the right angle.

Anyone has an idea how to do this? I am open to completely different methods…

Thank you


I found a way looking at a recent post. I didn’t think of using a parent empty gameObject as a pivot point. The solution is simple after that.

Ok I didn’t know how to close it I didn’t think of answering myself. Basically I parented the camera to an empty GameObject, and then you can just apply any kind of rotation to that pivot point and the camera will turn with it, thus creating the same effect as rotateAround but with damping and precision. Seems simple but I didn’t think of it before seeing another question…