1 public SkinnedMeshRenderer rendererBody; 2 Mesh mesh; 3 4 private void Awake() 5 { 6 Instance = this; 7 8 mesh = new Mesh(); 9 } 10 11 public Vector3[] GetMeshBodyWorldPoint() 12 { 13 Vector3[] v3s = null; 14 if (rendererBody != null) 15 { 16 //这里是关键,将一个蒙皮动画的某个时间点上的动作,Bake成一个不带蒙皮的Mesh 17 rendererBody.BakeMesh(mesh); 18 int count = mesh.vertexCount; 19 v3s = new Vector3[count]; 20 Vector3[] meshv3s = mesh.vertices; 21 for (int i = 0; i < count; i++) 22 { 23 v3s[i] = transform.TransformPoint(meshv3s[i]); 24 } 25 } 26 return v3s; 27 }