Пример #1
0
 private void UpdateCollisionMesh()
 {
     if (this.mesh != null)
     {
         for (int i = 0; i < this.newVert.Length; i++)
         {
             this.newVert[i] = new Vector3(0f, 0f, 0f);
         }
         foreach (CWeightList cweightList in this.nodeWeights)
         {
             foreach (object obj in cweightList.weights)
             {
                 CVertexWeight cvertexWeight = (CVertexWeight)obj;
                 this.newVert[cvertexWeight.index] += cweightList.transform.localToWorldMatrix.MultiplyPoint3x4(cvertexWeight.localPosition) * cvertexWeight.weight;
             }
         }
         for (int k = 0; k < this.newVert.Length; k++)
         {
             this.newVert[k] = base.transform.InverseTransformPoint(this.newVert[k]);
         }
         this.mesh.vertices = this.newVert;
         this.mesh.RecalculateBounds();
         this.collide.sharedMesh = this.mesh;
     }
 }
Пример #2
0
 private void UpdateCollisionMesh()
 {
     if (this.mesh != null)
     {
         for (int i = 0; i < this.newVert.Length; i++)
         {
             this.newVert[i] = new Vector3(0f, 0f, 0f);
         }
         foreach (CWeightList cweightList in this.nodeWeights)
         {
             IEnumerator enumerator = cweightList.weights.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     object        obj           = enumerator.Current;
                     CVertexWeight cvertexWeight = (CVertexWeight)obj;
                     this.newVert[cvertexWeight.index] += cweightList.transform.localToWorldMatrix.MultiplyPoint3x4(cvertexWeight.localPosition) * cvertexWeight.weight;
                 }
             }
             finally
             {
                 IDisposable disposable;
                 if ((disposable = (enumerator as IDisposable)) != null)
                 {
                     disposable.Dispose();
                 }
             }
         }
         for (int k = 0; k < this.newVert.Length; k++)
         {
             this.newVert[k] = base.transform.InverseTransformPoint(this.newVert[k]);
         }
         this.mesh.vertices = this.newVert;
         this.mesh.RecalculateBounds();
         this.collide.sharedMesh = this.mesh;
     }
 }