Unity 修改面板Rotation

 void Test(float f)
    {
        Quaternion quaternion = rcCar.transform.localRotation;
        quaternion.eulerAngles = new Vector3(0,A().y + f,0);
        rcCar.transform.DOLocalRotateQuaternion(quaternion,0.1f).SetEase(Ease.Linear);
    }

    Vector3 A()
    {
        rcCar = this.gameObject;
        System.Type transformType = transform.GetType();
        PropertyInfo m_propertyInfo_rotationOrder = transformType.GetProperty("rotationOrder",BindingFlags.Instance | BindingFlags.NonPublic);
        object m_OldRotationOrder = m_propertyInfo_rotationOrder.GetValue(transform,null);
        MethodInfo m_methodInfo_GetLocalEulerAngles = transformType.GetMethod("GetLocalEulerAngles",BindingFlags.Instance | BindingFlags.NonPublic);
        object value = m_methodInfo_GetLocalEulerAngles.Invoke(transform,new object[] { m_OldRotationOrder });
        string str = value.ToString().Replace("("," ").Replace(")"," ");
        string[] s = str.Split(',');
        return new Vector3(float.Parse(s[0]),float.Parse(s[1]),float.Parse(s[2]));
    }

你可能感兴趣的:(Unity 修改面板Rotation)