/// <summary> /// Projects UVs for each face using the closest normal on a sphere. /// </summary> /// <param name="pb"></param> /// <param name="indexes"></param> /// <param name="channel"></param> public static void ProjectFacesSphere(ProBuilderMesh pb, int[] indexes, int channel = 0) { foreach (Face f in pb.facesInternal) { if (ArrayUtility.ContainsMatch <int>(f.distinctIndexesInternal, indexes)) { f.elementGroup = -1; f.manualUV = true; } } SplitUVs(pb, indexes); Vector2[] projected = Projection.SphericalProject(pb.positionsInternal, indexes); Vector2[] uv = GetUVs(pb, channel); for (int i = 0; i < indexes.Length; i++) { uv[indexes[i]] = projected[i]; } /* and set the msh uv array using the new coordintaes */ ApplyUVs(pb, uv, channel); }