Greetings! I am currently making a floor placement system kinda not idk how, and I’d like guidance. The only post I could find on it was this, and I liked what he made here:
I am not asking for you guys to do it for me, but explain how to do it. His solution uses (that he set) triangles, but I think the thing above would work better.
So you can either perform triangulation, which is taking in the vertices of a polygon and joining them in a fashion to fill the shape with polygons. There are many different algorithms to do this, examples being delaunay or ear-clipping. Quick search of that thread even revealed this. However, I highly recommend you read up on it - there are many, many sources available via Google.
However, if you only want to allow non-complex convex polygons, you can sort the polygon vertices by winding order, and draw triangles from the 1st index and the nth and n+1th index until you complete the shape. Similarly, you could get the centre of the polygon and draw the triangles in winding order as n and n+1 to the centre.
Hi there. This may be kind of late but if you still need a guide on how to do it, here it is.
Firstly, you may need a placement system for the nodes, and have a table to place the nodes in.
Loop through the table to find how many nodes are there.
Using this 3Dtriangle creation module (Module here), you can create the part that is formed by the nodes
From the script:
let a be table[1]
b be table[2]
c be table[3]
For more than 4 nodes, you can simple do this:
if #table == 3 then
a = table[1]
b = table[2]
c = table[3]
elseif #table > 3 then
a = table[1]
b = table[#table - 1]
c = table[#table]
The above image will explain how the nodes are connected
This method uses overlapping triangles to create a floor, when there are more than 3 nodes,
the first loop will create a triangle in the first three nodes while the second loop will create a triangle in the subsequent nodes. You may want to draw it out on a piece of paper on how it connects the nodes to form a floor.
Here is an uncopylocked place created by me previously, you can play around with the script inside to see how everything works, this may not be the best way to do it but i hope that this still serves as a guide on how you can do it, i have also annotated and explained all the key points in the script: