Updating Indices of a Mesh: `updateIndices` vs ` setVerticesBuffer`

I’m making a 3d room and want to offer the ability to hide any number of walls at once. Naively, I would think that I can keep the mesh positions untouched and simply update the vertices to include or remove the facets corresponding to a given wall in the mesh to show/hide a wall.

I’m seeing these two methods in the docs and was hoping to get some clarity around their differences and if one is more appropriate for my circumstances? Thanks!

Hey the vertex buffer is the current geometry meaning the list of vertices.
The indices are the definition of each face, so literally an array of triplets (a, b,c where each number is the index of a vertex in the vertex buffer)

So in your case it seems that the updateIndices is the way to go :wink:


Hello @nerdsrock just checking in, was your question answered?

It was! Realized that I forgot to mark the question as solved. Thanks for the bump!

Could someone please clarify it to me, why such approach is better than just simple isVisible = false for the mesh to make it invisible? Maybe some performance issues or smth like that?

It is only a different requirement. One is valid when you have vertices to update from external data that could potential change like a moving height map for instance.

For sure if you have only some predefined walls from a 3d models, hiding some meshes would be more performant than updating the internal data.