Download

Randomly occuring issue involving tris of Procedural Mesh

I have a really weird issue with the tris when trying to spawn a Procedural Mesh. As far as I understand, the “Tris” input dictates how to sew the vertices together either clockwise or counter-clockwise to form a triangle to be rendered.

Here’s me spawning a simple plane with one vertex raised (Not the same vertex number between the planes). The vertex positions are written, as well as the tri array for that mesh section. I’m also writing them below:

Tri1: [0 2 1 3 1 2]

Tri2: [0 2 3 3 1 0]

The problem can be clearly seen in the image: Despite them having different “folds” as defined by the tri arguments, they still form the same shape. My Tri argument does not make them differ from each other. Similarily, there can be meshes with the same fold. I am 100% certain they use different tri arguments and also that the vertex positions are correct. I’ve even changed Tri2 to be an array of 1’s, but still no difference, and it’s even strange it accepts that as an argument.

And the biggest issue is that this occurs randomly when generating lots of these tiles. Some of the formations shaped like above thus works fine, and some do not.

Here’s the spawning part of my code. Calculations seem to work correctly, and if I invert one of the tri calculations, some will be fixed and some will become broken. I am using RuntimeMeshComponent at the moment, but the ProceduralMesh does the exact same thing. I’ve tried inputting stuff to normals/tangents but I can’t get it to do anything with these.

How is it possible this can occur?

Thanks

Edit: I’ve narrowed it down to the Mesh Component not updating triangles. In a ProceduralMesh, you can’t update the triangles at all, and in the RuntimeMeshComponent plugin, the feature doesn’t work.

Workaround: Use Create Mesh Section instead, to overwrite the old one.