Triangle vertex order changes face normal?

Hi!

I’m trying to use this article to learn a bit about procedural meshes:

When I add in a 4th vertex so that I can make a simple square, no matter the normal I assign to it, it seems the normal of the new triangle seems to change depending on the sequence that the vertices are connected?

TArray<FVector> vertices;
	vertices.Add(FVector(0, 0, 0));
	vertices.Add(FVector(0, 100, 0));
	vertices.Add(FVector(0, 0, 100));

	vertices.Add(FVector(0, 100, 100));

	TArray<int32> Triangles;
	Triangles.Add(0);
	Triangles.Add(1);
	Triangles.Add(2);    
	
	Triangles.Add(1);
	Triangles.Add(2);
	Triangles.Add(3);
	    	
	//Triangles.Add(3);
	//Triangles.Add(2);
	//Triangles.Add(1);
	
	TArray<FVector> normals;
	normals.Add(FVector(1, 0, 0));
	normals.Add(FVector(1, 0, 0));
	normals.Add(FVector(1, 0, 0));

	normals.Add(FVector(1, 0, 0));

To me it seemed logical that my new triangle needed to be made of the Triangles indices: 1,2, then 3. This ended up making a triangle like this picture (spawned two copies of the Actor to show the different triangle normal):

But if I change the order of the Triangles indices to be 3,2, then 1 (as in the commented out code) then I get a more correct looking face:

Why is it that the order of adding the indices matters? And how do we work out which way we want in more complex geometry?

Looking at this 24hrs later, it looks like it’s to do with the winding order. I learnt something today! I suppose for these simple shapes I should just focus on getting the winding order right, and ignore providing the optional vertex normals.

Apart from parts of the geometry not displaying as expected in the world, is there some way to quickly work out (in the c++ code) which order the vertex indices should go to make it an anti clockwise triangle?

https://www.opengl.org/wiki/Face_Culling