正在加载视频...
视频加载失败
With DynamicMesh coming to Roblox, I thought now would be a great time to explain something I remade recently :D Mesh Splitting! #Roblox #RobloxDev Thread🧵
43,288 次观看 • 3 年前 •via X (Twitter)
12 条评论

Triangles are usually the building blocks of meshes. So to begin, I needed to figure out how to split a single triangle. Here was a simple procedure I quickly drew out, the red line indicates a cut.

A triangle is made of three line segments. Iterating through the edges and using some algebra, we can calculate the two points that intersect a plane cut!

With the two intersections, the triangle can be split into three smaller triangles as shown in the previous diagram.

Separating the two polygons will give us a split triangle! Onwards to the third dimension.

Here I constructed a cube made of triangles. Using the same math as before, we can figure out which triangle to split, colored in blue. Yellow and red indicate non-intersecting triangles on two sides of the plane, which will be grouped later.

Calculating the intersections of the intersecting triangles like before we can separate the mesh into two groups. Looks like its all coming together!

I then filled in the mesh using Wedges since DynamicMesh hasn't been released yet. You may have already noticed, but the interior is hollow. We can't be having that :(

So to cover it up, we can use the points we calculated to find the intersection of the mesh on the plane cut.

Constructing a vertex graph, we can traverse a single cycle to fill in this polygon intersection. Why does it look so satisfying? 😋

Wrapping it all together with a touch of welding and physics.. tada! Mesh splitting!

Bonus clips: Cutting an eggdog??

How about cutting a sphere brick, slowed down?
