Hello fellow uniteres!
I have a third person game where the camera is free to rotate around when the player is not moving. And when the player is moving the players Y axis lines with the cameras Y axis, but when doing so the player "snaps" to the cameras Y axis.
I want to make this smooth and therefor considering using Quaternion.Slerp, but the problem using Quaternion.Slerp is that it is "Slerping" all axis X, Y, Z, but as said I only want to "Slerp" the Y axis. Is this possible(It most likely, but I do not know how to) I have tried Mathf.Clamp, but that causes "shaky" movements and slow fall through the floor.
The current code I use for the rotation right now is this(small sample only):
So can you please tell me a way to restricting "Slerping" to the Y axis only. I will be greatfull!
transform.rotation.y = Quaternion.Slerp(bla bla bla).y;
answered Jun 08 '11 at 10:29 PM
After the Quaternion.Slerp statment
transform.localEulerAngles = Vector3(0, transform.localEulerAngles.y, 0);
answered Jun 09 '11 at 05:21 AM