美文网首页
Unity 修改面板Rotation

Unity 修改面板Rotation

作者: U3D界金城武 | 来源:发表于2020-10-22 18:45 被阅读0次
     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

          本文链接:https://www.haomeiwen.com/subject/czepmktx.html