![]() ![]() A small complication is that Unity wants an array of Vector3s, so we need to convert them. Specifying vertices is easy, as we can list them in an array of Vector2s. To display the mesh, we apply it to a GameObject’s MeshFilter component.īelow is a script that can be added to any empty object to draw the shape in the image above. Unity allows each vertex to be colored differently, so we will demonstrate this by feeding our mesh random colors. To draw a mesh programmatically, Unity requires an array of its vertices and triangles. This tutorial will implement drawing rectangles, circles, and triangles. ![]() So let’s do the same thing in Unity! Conveniently, Unity has excellent support for 2D physics, so implementing a basic prototype is fairly simple to do.
0 Comments
Leave a Reply. |