automatically creating triangles

Hi,

I want to know if there is a way to automatically creating triangles in a mesh.

For example, I set the vertices and do a “magic” command :slight_smile:

I’m making a applications that the user can draw lines, these lines will be transformed in walls (a closed room) but I’m having the problem to figure How can I make the floor, depending the form the user draws the room, I say, If the form drawed is Convex, it’s ok, but if the form is concave, i don’t know how to make the vertices links, ensuring the form shape.

You can see the project here:

widemedia.com.br/projetos/homebuilder

Thanks,

Borgo

the very short answer is, no, you have to do it by hand and it's very, very difficult indeed! Bear in mind that software systems like Maya -- which exist to do precisely what you describe -- are developed by literally thousands of people. It's a huge mathematical and research and development undertaking.

–

2 Answers

2

There is no magic about it. You have to set the vertices first. Then use mesh.triangles to specify which vertices form a triangle.

Ok, So I have a big problem :) I'm making a applications that the user can draw lines, these lines will be transformed in walls (a closed room) but I'm having the problem to figure How can I make the floor, depending the form the user draws the room, I say, If the form drawed is Convex, it's ok, but if the form is concave, i don't know how to make the vertices links, ensuring the form shape. You can see the project here: widemedia.com.br/projetos/homebuilder

–

So the lines should get transformed into a surface? When do you start this transformation? When he stops drawing or only if he closed the lines?

–

Not exactly the lines, but the points that the user have clicked. The transformation occurs when the user click on the first point, this ensures that every form drawed will be closed.

–

So from each closed form you create a surface? Then you could just limit the user to draw the points in the correct order and create the triangles yourself. If you don't want to do that (the limitation) you could still figure out which is the top right topleft and so on.

–

The points will be drawed in a correct order, the problem is the "concave" forms, I don't want to make a application that make only convex rooms, i want to make a solution to make concave rooms too. I know that it possible, but I dont know how can I make it. Look at the link I have posted, You can make any room form you want, when you close the form, the program create the walls (regardless if the user drew clockwise or counterclockwise), so I have the vertices points of the surface.

–

I found a script in UnifyCommunity:

File not found. EDIT: http://wiki.unity3d.com/index.php/Triangulator

–

http://www.unifycommunity.com/wiki/index.php?title=Triangulator this link is working now.. just created a floor depending upon the walls

–