Home > Blockchain >  Unity mirroring a mesh but the colors are facing down
Unity mirroring a mesh but the colors are facing down

Time:06-02

I am trying to mirror a mesh to another mesh by using procedural mesh generation as seen below. The original mesh is at the positive z axis while the mirrored is at the negative z axis.

The vertices are all mirrored as I wanted but the color is facing down instead of up.

I tried to change the mesh uvs and normals but both did no affect on the mirrored mesh. I heard the triangles have to be reversed in their array or something that I do not understand. How do I make the mirrored mesh color face up?

The black plane is supposed to be half transparent blue water plane but it is not part of my question so I guess do not mind it.

CodePudding user response:

Not 100% sure but I suspect it is the triangles as you say.

You would probably simply need to invert the triangles => simply invert the array e.g. using Array.Reverse like e.g.

var triangles = mirroredMesh.triangles;
Array.Reverse(triangles);
mirroredMesh.triangles = triangles;
  • Related