Hi! I have a component that acts an analogic joystick and i player character that should rotate accordingly with the movement of the joystick object.
In a 2d game i would get the tangent of the x and y of the joystick to get the angle and apply it to the object. But here i don't understand how to do that with quaternions...
Right now i got the direction working so i already have the Vector3 that i would need to use to calculate the rotation.
Suppose my direction vector is (10,0,10) so my player is moving up-right(from my over the head view) i would need him to face that direction also.
Thanks in advance.
Simply use Quaternion.LookRotation(directionVector).
answered Nov 19 '09 at 12:59 PM
jonas echterhoff ♦♦