Answers for "how to convert the angle to roatation?"
http://answers.unity.com/questions/798107/how-to-convert-the-angle-to-roatation.html
The latest answers for the question "how to convert the angle to roatation?"Answer by robertbu
http://answers.unity.com/answers/798113/view.html
Vector3.Angle() does not help you since the result is unsigned. Given the forward vector of your vehicle and a vector indicating where you want it to point you can create a Quaternion:
var q = Quaternion.FromTo(myForward, nextDirection);
...then you can set the rotation immediately by:
transform.rotation = q * transform.rotation;
...or you can do it over time with easing by:
transform.rotation = Quaternion.Slerp(transform.rotation, q * transform.rotation, Time.deltaTime * speed);
For a vehicle, you sometimes want to force the angle of rotation. Assuming you've defined the front of your vehicle as the side facing positive 'z' when the rotation is (0,0,0), you can use Quaternion.LookRotation():
var q = Quaterion.LookRotation(nextDirection, transform.up);
...and the Slerp would be:
transform.rotation = Quaternion.Slerp(transform.rotation, q, Time.deltaTime * speed);
Note for a non-eased rotation, Slerp() can be replace by RotateTowards(). 'speed' would then be measured in degrees per second and would have to be greatly increased from the value used in Slerp().Fri, 26 Sep 2014 14:39:59 GMTrobertbu