Quantcast
Channel: Latest Questions by frogsbo
Viewing all articles
Browse latest Browse all 90

problem with loop and mesh values

$
0
0
Trying to delete n colored uvs and vertices from a mesh, but after 4 loops, it sais the index is out of range, even though it is counting down from top to bottom. ![alt text][1] i dont understand. var vtxlist = new List.(); var vtx2 = mesh2.vertices; vtxlist = vtx2.ToList(); var nmlist = new List.(); var norms2 = mesh2.normals; nmlist = norms2.ToList(); var uvlist = new List.(); var uvv2 = mesh2.uv; uvlist = uvv2.ToList(); var trilist = new List.(); var tris2 = mesh2.triangles; trilist = tris2.ToList(); print( trilist.Count + " yahhahyfuhsu " + tris2.length); for ( var i = tris2.length-1; i >= 0 ; i -- ) { if(uvv2[tris2[i]] == p0) { print( " deleted mesh vales at index number " + i ); if (vtxlist[tris2[i]] !=null)vtxlist.RemoveAt(tris2[i] ); if (nmlist[tris2[i]] !=null)nmlist.RemoveAt(tris2[i] ); if (uvlist[tris2[i]] !=null)uvlist.RemoveAt(tris2[i] ); if (tris2[i] !=null)trilist.RemoveAt(i ); } } mesh2.triangles = trilist.ToArray(); mesh2.normals = nmlist.ToArray(); mesh2.uv = uvlist.ToArray(); mesh2.vertices = vtxlist.ToArray(); [1]: /storage/temp/27421-meshval.png

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>