示例#1
0
        public static Quaternion ToQuaternion(string str)
        {
            SysUtil.Assert(str != null, "null str to quaternion");

            string[] vals = str.Split(',');
            SysUtil.Assert(vals.Length == 4, "bad format str \"" + str + "\" to quaternion");

            Quaternion quat = new Quaternion();

            quat.x = Convert.ToSingle(vals[0]);
            quat.y = Convert.ToSingle(vals[1]);
            quat.z = Convert.ToSingle(vals[2]);
            quat.z = Convert.ToSingle(vals[3]);
            return(quat);
        }
示例#2
0
        public static Vector3 ToVector3(string str, char separator)
        {
            SysUtil.Assert(str != null, "null str to vector3");

            string[] vals = str.Split(separator);
            SysUtil.Assert(vals.Length == 3, "bad format str \"" + str + "\" to vector3");

            Vector3 vec;

            vec.x = Convert.ToSingle(vals[0]);
            vec.y = Convert.ToSingle(vals[1]);
            vec.z = Convert.ToSingle(vals[2]);

            return(vec);
        }