ForceSharedVerticies reduces count of mesh and geometry verticies but not indicies etc

Hi lovely people of Babylon :]
i was trying to get vertex position by indicies as Vector3. I searched trough the forum for a while and found similar topics talking about acessing verticies of mesh as Vector3 like it can be done in threejs. Since there is no tool to do that i tried to few solutions, by iterating, comparing and reducing vertexData to get the right index and using that to create vector3 from vertexData. But i found it very messy iterating over all the data especially when the mesh got big. So i tried to to reduce vertex count by using forceSharedVerticies, which reduced vertex count but not the indicies. I looked at forceSharedVerticies in Mesh class and it seems like the vertexData is the only thing that is getting updated. I’m kind of new to babylon so i’m not sure if this is expected behavior or not. Is it a bug?

Thanks in advance! :slight_smile:

PG: https://playground.babylonjs.com/#8D0JGK#2

Hello and welcome!!

forceSharedVertices will force the faces to share vertices instead of having their own individual copies. So it works as expected :slight_smile:

If you want to recuce the number of faces, you may want to have a look at mesh simplification: Simplify a Mesh with Auto-LOD - Babylon.js Documentation