Commits

David Erosa  committed 21e2cbe

Fix triangle order and remove MeshFilter (just used for testing)

  • Participants
  • Parent commits 4dff870

Comments (0)

Files changed (1)

File Code/TileMap.cs

 		GameObject polyline = new GameObject ("Collider_polyline" + colliderX + colliderY);
 		Mesh mesh = new Mesh ();
 		polyline.AddComponent<MeshCollider> ();
+//		polyline.AddComponent<MeshFilter> ();
+//		polyline.AddComponent<MeshRenderer> ();
 		
 		ArrayList points = new ArrayList ();
 		List<Vector3> vertices = new List<Vector3> ();
 			Vector3 firstBack = new Vector3 (firstPoint.x, firstPoint.y, 10.0f);
 			Vector3 secondFront = new Vector3 (secondPoint.x, secondPoint.y, -10.0f);
 			Vector3 secondBack = new Vector3 (secondPoint.x, secondPoint.y, 10.0f);
-			vertices.Add (firstFront);
-			vertices.Add (firstBack);
-			vertices.Add (secondFront);
-			vertices.Add (secondBack);
+			vertices.Add (firstFront); // 0
+			vertices.Add (firstBack); // 1
+			vertices.Add (secondFront); // 2
+			vertices.Add (secondBack); // 3
 			
 			verticesOrder.Add ((idx - 1) * 4 + 0);
 			verticesOrder.Add ((idx - 1) * 4 + 1);
 			verticesOrder.Add ((idx - 1) * 4 + 3);
 
-			verticesOrder.Add ((idx - 1) * 4 + 2);
 			verticesOrder.Add ((idx - 1) * 4 + 3);
+			verticesOrder.Add ((idx - 1) * 4 + 2);
 			verticesOrder.Add ((idx - 1) * 4 + 0);
 
 			firstPoint = secondPoint;
 		mesh.RecalculateNormals ();
 		
 		polyline.GetComponent<MeshCollider> ().sharedMesh = mesh;
+//		polyline.GetComponent<MeshFilter> ().mesh = mesh;
 		
 		return polyline;
 	}