unity 四元数, 两行等价的代码
Vector3 tmpvc; 1. tmpvc = Quaternion.Euler (new Vector3 (0, 30, 0)) * new Vector3 (0, 0, 1); 2. tmpvc = new Vector3 (sin (30.0f), 0, cos (30.0f)); transform.position = target.transform.position + tmpvc.normalized * 5;
第二个tmpvc 不用normalized
float sin (float v)
{
return Mathf.Sin (real (v));
}
float cos (float v)
{
return Mathf.Cos (real (v));
}
float real (float v)
{
return v / 180.0f * 3.1415926f;
}