using UnityEngine;
namespace Game
{
    public abstract partial class Util
    {
        //返回角度值(-180,180],(1,0,0)为0
        //只关注y=0平面的向量
        public static float Vec3ToRot(Vector3 vector)
        {
            var rot = Quaternion.FromToRotation(vector, Vector3.right);
            return rot.eulerAngles.y;
        }
        public static Quaternion Rot2Quaternion(float rot)
        {
            return Quaternion.AngleAxis(rot, Vector3.forward);
        }
        /// 
        /// 角度转弧度
        /// 
        /// 
        /// 
        public static float ToRadian(float rot)
        {
            return rot * Mathf.PI / 180f;
        }
        /// 
        /// 弧度转角度
        /// 
        /// 
        /// 
        public static float ToAngle(float rot)
        {
            return rot * 180f / Mathf.PI;
        }
    }
}