Hello. I tryed to serch everywhere but still need help.
For my project I need to deform meshes based on difference of pre-made meshes. The algorithm is simple: take two meshes, take a vertex with same index from each mesh, calculate displacement vector between them, and changes the first of this two vertexes’ position along this vector by a certain value (the value is taken from slider).
The code is like
SourceVertArray=mesh1.vertices;
MorfVertArray=mesh2.vertices;
for ( i = 0; i < SourceVertArray.length; i++){
SourceVertArray _+= (MorfVertArray - SourceVertArray) * MorfValue;_
}
mesh1.vertices=SourceVertArray;
----------
I made a mesh, saved it to a file, than changed position of several vertexes and saved it again to another file. I checked in stand-alone model viewer that vertex counts and indexes are same, but when I import this meshes to project, the nomber of vertices changed and, even the program works and displaces vertexes, vertex indexes was mixed.
The only difference between meshes must be vertex positions and normal orientation. I checked through all eveluable checkboxes in inspector, checked combinations of export checkboxes in Hexagon while exporting mesh, but inspector keep showing different vertex nombers and in vertex indexes keep being messed so vertexes was mooved not where them supposed to.
I triangulated all quads in the mesh in editor program, saved it, mooved vertexes and saved again. The vertex nomber in Unity was higher than really was in each mesh and Unity added several to one and some more to another.
I made a mesh, saved, loaded in Unity, saved out from Editor and than modifyed that mesh in Hexagon and again Unity added some vertexes. The only variant worked is when I slightly mooved some vertexes manually.