void CreateMesh() { urgMesh.Clear(); urgMesh.AddVertex(PosOffset); urgMesh.AddUv(Camera.main.WorldToViewportPoint(PosOffset)); for (int i = distances.Length - 1; i >= 0; i--) { urgMesh.AddVertex(scale * Index2Position(i) + PosOffset); urgMesh.AddUv(Camera.main.WorldToViewportPoint(scale * Index2Position(i) + PosOffset)); } for (int i = 0; i < distances.Length - 1; i++) { urgMesh.AddIndices(new int[] { 0, i + 1, i + 2 }); } }
void CreateMesh() { urgMesh.Clear(); urgMesh.AddVertex(PosOffset); urgMesh.AddUv(cam.WorldToViewportPoint(PosOffset)); for (int i = distances.Length - 1; i >= 0; i--) { //urgMesh.AddVertex(scale * Index2Position(i) + PosOffset); //urgMesh.AddUv(Camera.main.WorldToViewportPoint(scale * Index2Position(i) + PosOffset)); urgMesh.AddVertex(new Vector3(_scale.x * Index2Position(i).x + PosOffset.x, _scale.y * Index2Position(i).y + PosOffset.y, 1)); urgMesh.AddUv(cam.WorldToViewportPoint(new Vector3(_scale.x * Index2Position(i).x + PosOffset.x, _scale.y * Index2Position(i).y + PosOffset.y, 1))); } for (int i = 0; i < distances.Length - 1; i++) { urgMesh.AddIndices(new int[] { 0, i + 1, i + 2 }); } }