That was illustration purposes. And I don't have 3dsmax, so I cannot say, but it should, since that should have all the base functions max4 had. I included my two custom array functions just in case it would not, and in case you aren't already using my library.
I actually don't suggest anybody use the code above. I made some huge changes today and it works MUCH better now.
- I tweaked the edge checker so it now validates open edges (the ones along the tile edge) and can work with them when flipping.
- I also determined what was flipping entire faces, and found it was happening when a vert only connected to 3 or less edges, so I wrote a checker for that, disallowing flipping on such places.
- And then I realized the system exception is built into the code for their Meshop.getEdgesReverseEdge function. It is totally fubar, so I wrote a new one.
No crashes now. About 5 runs of this on any 10x10 mesh and it looks wonderful compared to the original.
Instead of updating the function above (which still works, just not nicely), I'm going to wait and release the better one on the vault with my library.
If I had to change one more thing, I would check for faces which are 100% vertical when verts are snapped to integers. This current code leaves a few sharp ledges that are between 0.0 and 1.0 when you look at the distance from the edge center to the nearest vert above or below. That will probably make the walkmesh mad at that point, but I have not tried yet.
One question I have is whether or not the snapping of verts to integers is beneficial for anything but the outer edge of the tile mesh? If not, I won't bother. If it is just the drive space being saved by not storing the long decimal, I don't really worry about that much. But if people intend to snap my verts to integers in the future, leaving them like this is going to make a headache for somebody else down the road.





Retour en haut










