- Home /
How do I rotate a Gameobject to a given direction smoothly?
I am creating a 3D chess game and I want to rotate the board along the z axis using the mouse. This works perfectly, but the problem arises when I want to reset the board back to its default position, my c# script works fine but when I press the middle mouse button it instantly teleports back to its default position rather than rotating smoothly.
Is there anything I can do?
Answer by namcap · Jun 10, 2020 at 03:14 AM
You can use a Coroutine to set the rotation to last as long as you'd like. In that Coroutine, use the Quaternion.Slerp method to interpolate between the current rotation and your desired rotation.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Smooth Camera Rotate 2 Answers
How do I rotate my character smoothly? 1 Answer
Distribute terrain in zones 3 Answers
Rotate camera around object smoothly 2 Answers