예제 #1
0
 protected virtual void WriteMesh()
 {
     MeshUtility.InverseTransformMesh(tsMesh, transform);
     if (_doubleSided)
     {
         MeshUtility.MakeDoublesidedHalf(tsMesh);
     }
     else if (_flipFaces)
     {
         MeshUtility.FlipFaces(tsMesh);
     }
     if (_tangents)
     {
         MeshUtility.CalculateTangents(tsMesh);
     }
     if (tsMesh.vertexCount > 64000)
     {
         Debug.LogError("WARNING: The generated mesh for " + name + " has " + tsMesh.vertexCount + " vertices. The maximum vertex count for meshes in Unity is 64000. The mesh will not be updated.");
     }
     tsMesh.WriteMesh(ref mesh);
     if (_normalMethod == 0)
     {
         mesh.RecalculateNormals();
     }
     if (filter != null)
     {
         filter.sharedMesh = mesh;
     }
     updateCollider = true;
 }
예제 #2
0
 protected virtual void WriteMesh()
 {
     MeshUtility.InverseTransformMesh(tsMesh, this.transform);
     if (_doubleSided)
     {
         MeshUtility.MakeDoublesided(tsMesh);
     }
     else if (_flipFaces)
     {
         MeshUtility.FlipFaces(tsMesh);
     }
     if (_tangents)
     {
         MeshUtility.CalculateTangents(tsMesh);
     }
     tsMesh.WriteMesh(ref mesh);
     if (_normalMethod == 0)
     {
         mesh.RecalculateNormals();
     }
     if (filter != null)
     {
         filter.sharedMesh = mesh;
     }
     updateCollider = true;
 }
예제 #3
0
 private void ApplyMesh()
 {
     if (!(filter == null))
     {
         MeshUtility.InverseTransformMesh(editMesh, transform.transform);
         MeshUtility.CalculateTangents(editMesh);
         if (destinationMesh == null)
         {
             destinationMesh      = new Mesh();
             destinationMesh.name = originalMesh.name;
         }
         editMesh.WriteMesh(ref destinationMesh);
         destinationMesh.RecalculateBounds();
         filter.sharedMesh = destinationMesh;
     }
 }
예제 #4
0
 private void ApplyCollider()
 {
     if (collider == null)
     {
         return;
     }
     if (originalColliderMesh == originalMesh)
     {
         collider.sharedMesh = filter.sharedMesh;
         return;
     }
     MeshUtility.InverseTransformMesh(editColliderMesh, transform.transform);
     MeshUtility.CalculateTangents(editColliderMesh);
     if (destinationColliderMesh == null)
     {
         destinationColliderMesh      = new Mesh();
         destinationColliderMesh.name = originalColliderMesh.name;
     }
     editColliderMesh.WriteMesh(ref destinationColliderMesh);
     destinationColliderMesh.RecalculateBounds();
     collider.sharedMesh = destinationColliderMesh;
 }