示例#1
0
    public static bool IsCloseXToClampAmount(Quaternion q, float minX, float maxX, float margin = 2)
    {
        if (q.w == 0)
        {
            return(true);
        }

        q.x /= q.w;
        q.y /= q.w;
        q.z /= q.w;
        q.w  = 1.0f;

        float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan(q.x);

        if (ExtMathf.IsClose(angleX, minX, margin) ||
            ExtMathf.IsClose(angleX, maxX, margin))
        {
            return(true);
        }
        return(false);
    }