// Update is called once per frame
    void Update()
    {
        v2 = UnityEditor.TransformUtils.GetInspectorRotation(t);
        v3 = t.localEulerAngles;
        q  = t.localRotation;
        RotationalComponents c1 = RotationalComponents.FromEuler(v2);
        RotationalComponents c2 = RotationalComponents.FromEuler(v3);

        q2 = c1.UnityQuaternion;
        q3 = c2.UnityQuaternion;
        transformMatrixWorldToLocal = t.worldToLocalMatrix;
        transformMatrixLocalToWorld = t.localToWorldMatrix;
        //t.localRotation = q3;
        t.localEulerAngles = t.localRotation.eulerAngles;
    }
        public static RotationalComponents FromEuler(Vector3 euler)
        {
            RotationalComponents c = new RotationalComponents((double)euler.x, (double)euler.y, (double)euler.z);

            return(c);
        }