So I’m using Unity.
I’ll try and explain. The mesh is:
Sprite sprite = m_SpriteRenderer.sprite;
I am trying to store half of its triangles and vertices in four separate variables:
ushort triA = triangles.Take(triangles.Length / 2).ToArray();
ushort triB = triangles.Skip(triangles.Length / 2).ToArray();
Vector2 spriteA = spriteVertices.Take(spriteVertices.Length / 2).ToArray();
Vector2 spriteB = spriteVertices.Skip(spriteVertices.Length / 2).ToArray();
Then, I instantiate those variables individually:
GameObject a = Instantiate(gameObject);
//Stops infinite loop
a.GetComponent<SplitCircle>().enabled = false;
* Error of Invalid triangle index array.
* Some indices are referencing out of bounds vertices,
* IndexCount: 189, VertexCount: 64
For simplicity, I'm only focused on the first half of the mesh.
My problem is understanding whether or not what I am doing makes sense. Do I even need to store the triangle? I also don’t understand how my triangle is referencing out of bound vertices.
I hope that clears.
Note: I know I can just create smaller game objects out of the sprite and create the illusion of a split but I wanted something more quality for what I'm doing.