- Home /
Connecting procedurally generated mesh verticies
Hello, so my issue is that I'm trying to generate procedural planes along a spline and then connect corresponding vertices at their midpoints. I would set the number of planes I want then then they all connect to each other when generated at runtime. So it's basically a simple form of extrusion along the spline.
However, when I try to move the vertices to connect at their midpoints, each mesh only ends up connecting to itself. So, say if I want to connect the top right vertex of a mesh, with the top left vertex of another mesh, the mesh connects its own top right and top left vertices to each other.
I guess this has something to do with me creating the mesh at runtime, but is there any way around this issue that anyone knows? Thank you.
private void meetAtCenter(Mesh m1, Mesh m2)
{
Vector3[] m1Verts = m1.vertices;
Vector3[] m2Verts = m2.vertices;
m1Verts[0] = m2Verts[2] = Vector3.Lerp(m1Verts[0], m2Verts[2], .5f);
m1Verts[1] = m2Verts[3] = Vector3.Lerp(m1Verts[1], m2Verts[3], .5f);
m1.vertices = m1Verts;
m2.vertices = m2Verts;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612144942im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Reducing draw calls unity simple randomly generated world? 0 Answers
How to cut a custom shape into a mesh? 0 Answers
Optimizing and generating terrain on mobile 1 Answer
Invert colours for a 2D sprite 1 Answer
When meshes are loaded ? 1 Answer