duck

duck

Sep 1st, 2010
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1.     MeshFilter meshFilter = AddComponent<MeshFilter>();
  2.     Mesh mesh = new Mesh();
  3.  
  4.     Vector3[] verts = new Vector3[] {
  5.         new Vector3(0, 0, 0),
  6.         new Vector3(1, 0, 0),
  7.         new Vector3(1, 0, 1),
  8.         new Vector3(0, 0, 1)
  9.     };
  10.  
  11.     int[] tris = new int[] { 0, 2, 1, 3, 2, 0 };
  12.  
  13.     Vector2[] uv1s = new Vector2[] {
  14.         new Vector2(0, 0),
  15.         new Vector2(1, 0),
  16.         new Vector2(1, 1),
  17.         new Vector2(0, 1)
  18.     };
  19.  
  20.  
  21.     // Assign mesh properties
  22.     mesh.vertices = verts;
  23.     mesh.uv = uv1s;
  24.     mesh.triangles = tris;
  25.     mesh.RecalculateNormals();
  26.     mesh.RecalculateBounds();
  27.     meshFilter.mesh = planeMesh;
Advertisement
Add Comment
Please, Sign In to add comment