- Home /
Triangular Prisms From A Mesh
I'm able to generate triangulated meshes using mattatz/unity-triangulation2D. My goal is to take each triangle and form a triangular prism from it. As far as I can tell this will require a procedural triangular prism primitive. I was imagining that this could be done a la https://blog.nobel-joergensen.com/2010/12/25/procedural-generated-mesh-in-unity/, but I believe I've run into a snag.
You can't expect to match the geometry of one of the mesh triangles simply by applying x, y, and z scales to the primitive triangular face. Instead you need an additional skew transform.
Or am I going about this the wrong way?
Answer by Bunny83 · Oct 10, 2019 at 10:36 AM
I think I don't quite understand the question. If you talk about actual triangular prisms then the result is just exactly the same as the 2d triangulation case, just that you add depth to it. You would just duplicate and offset the vertices for the backside and add the missing triangles. If each triangle / prism should have it's side walls you just duplicate the corresponding vertices again for each side face. When you create a mesh procedurally, you don't really work on premade prefabs. You just define you vertices and triangles procedurally.
If you talk about using a 3d simplex / tetrahedron I don't really see any reasonable way to go from a 2d triangle mesh to 3d. Each triangle would simply be a tetrahedron so it would have a spike to the back or front.
To me it's completely unclear where this should go. What's your actual goal? Your question is too generic / unclear to be answered in a clear manner. Please note that we offer help with technical problems and offer advice. This is not a site to get others do your job for you.
So first you should clear up, just for yourself, what the endresult should look like. Draw a picture or at least come up with clear examples how it should look like. It also helps to know for what exact purpose you need it. A little bit of background helps to better understand the issue and we might be able to offer simpler workarounds.
"When you create a mesh procedurally, you don't really work on premade prefabs. You just define you vertices and triangles procedurally." That answered my (underlying) question.
Thank you for your thoughtful reply.
Your answer
Follow this Question
Related Questions
Triangulation Problems 1 Answer
Building a prism (adding thickness) from non-convex mesh 0 Answers
3D Meshes: how to minimize error during reduction of order? 0 Answers
instantiating Transform insted of PrimativeType 1 Answer
Spawnning an object other than primitive makes the function run again and again 0 Answers