Trouble assigning triangles to the Procedurally Created Mesh

Hi all,
I am trying to procedurally create a room from users’ mouse click position. All the walls are created with no issues.Problem is while creating the floor.When all the points from mouse position are parallel or perpendicular from each other,floor mesh is created just fine(Pic 1).But when the corners are in the ‘L’ shape,the floor mesh creates an unexpected result in mesh(pic 2). I know the problem is in assigning the Triangles for the mesh. Can anyone please guide me in creating the algorithm for assigning triangles to the Procedurally generated mesh in a proper way.
Thank You

Pic 1

Pic 2

You could use something like this, I’ve used it before in C++ and it worked fine:

http://wiki.unity3d.com/index.php?title=Triangulator

2 Likes

Triangular is the way to go. It doesn’t do holes. But it will do everything else.

Thanks very much tonemcbride.Works like a charm!!