using System.Collections; using System.Collections.Generic; using UnityEngine; public static class VectorExtend { public static Vector3 Parse(this Vector3 self, string str) { return new Vector3(float.Parse(str.Split(',')[0]), float.Parse(str.Split(',')[2]), float.Parse(str.Split(',')[2])); } public static void TraSet(this Transform self, Vector3 v) { } } public static class Vector3Extension { /// /// 将xyz值放入一个长度为3的float数组中 /// /// 三维向量 /// float数组 public static float[] ToArray(this Vector3 self) { float[] retArray = new float[3]; retArray[0] = self.x; retArray[1] = self.y; retArray[2] = self.z; return retArray; } /// /// 转四元数 /// /// 三维向量 /// 四元数 public static Quaternion ToQuaternion(this Vector3 self) { return Quaternion.Euler(self); } }