Reputation: 27
I am trying this method as an alternative to making 2 other animations. I tried to make the picture self-explanatory. All I am trying to do is to have a way to make my character rotate about 90 degrees to the right when the right key is pressed and rotate about 90 degrees to the left when the left key is pressed. I have tried Quaternion.RotateTowards and Quaternion.Slerp, but to no avail for me. Thank you :)
This should make it more clear
Upvotes: 0
Views: 1111
Reputation: 405
I suppose something like this should work:
var direction = Mathf.Sign(Input.GetAxis("Horizontal")) * 90f;
transform.localRotation = Quaternion.Euler(0, direction, 0);
Upvotes: 0
Reputation: 55
Did you try the Transform.Rotate function with your character's transform object?
http://docs.unity3d.com/ScriptReference/Transform.Rotate.html
Upvotes: 1