- Home /
Smooth camera 90 degree rotation around target
Hello,
I am new to Unity and I am trying to research how to smoothly rotate the camera by 90 degree around a target on the Y axis - in my case, a cube - using the left and right key to move it -90 and 90 degrees respectively. The result I am after is that by clicking left and right, you see different sides of the cube.
I would like to see the code needed to achieve this? I came across Quaternion.Lerp/Slerp and Mathf.MoveTowardsAngle but not sure how to use them for my situation.
Answer by meat5000 · Sep 15, 2013 at 10:26 AM
There are hundreds of answers on this very topic.
Lerp has TO FROM and t field.
Progressively changing t from 0 to 1 progresses the output value of the function between From and To.
Lerp must be repeatedly called in the Update function to work correctly. It does not perform the whole function but returns an individual scaled value on each call. Call repeatedly changing t over time, parameters being the camera transform position, From where it starts To where its going.
Your answer
Follow this Question
Related Questions
Mouse Orbit snapping issues 0 Answers
Smoothly Rotate Character Y to Camera Y 2 Answers
Return Camera Rotation Z axis to 0 2 Answers