- Home /
Question by
chickencraft12345 · Mar 30, 2021 at 05:53 PM ·
2dmeshtrianglesvectors
Draw multiple triangles from a 2d vector of dots C#
I'm trying to draw multiple triangles (2D) from a 2d array that changes every frame. The 2d array holds an unknown amount of 3 Vector3s. Here is what I've tried so far:
void Update()
{
foreach (Vector3[] triangle in triangles)
{
Mesh mesh = new Mesh();
mesh.Clear()
mesh.vertices = triangle;
mesh.triangles = new int[] { 0, 1, 2 };
GetComponent<MeshFilter>().mesh = mesh;
}
}
but it doesn't seem to work how I wanted.
Comment
Your answer
Follow this Question
Related Questions
2d custom mesh triangulator problem 1 Answer
Having trouble implementing edge collapse operation with half-edge data structure 0 Answers
Understanding verts and triangles in Unity 1 Answer
Is it possible to generate a 2D view of a 3D object at runtime? 0 Answers
How to create accurate mesh from texture (like 2D sprites) 2 Answers