Hi,
I’m trying to modify the spatial mesh vertices. Works fine in the Unity Editor and I don’t see any substantial difference between my code and HoloToolkit’s vertex removal (other than that I preserve the number of triangles and do not remove any):
Mesh mesh = mesh_filter.sharedMesh;
…
Vector3[ ] verts = mesh.vertices;
… do some work on verts[ ] …
mesh.vertices = verts;
mesh.RecalculateBounds();
MeshCollider collider = mesh_filter.gameObject.GetComponent();
if (collider != null)
{
collider.sharedMesh = null;
collider.sharedMesh = mesh;
}
I render the spatial mesh with the wireframe material so I can see deformations but nothing happens on the actual device. It is as if they are not being updated at all! I’ve tried even more drastic things like clearing the mesh – both using Clear() and manually zeroing out the vertices – no effect!
Note: mesh_filter is obtained when spatial mapping is complete and I stop the observer. I obtain all the mesh filters using SpatialMappingManager.Instance.GetMeshFilters() once and then I keep them around in a List<>.
Any ideas?
Thanks,
Bart