1
votes

I am currently developing a Unity project for the HoloLens. For this I am using the Spatial Mapping Observer and the Spatial Mapping Manager from the HoloToolkit. I need to access the spatial Mesh, in particular the vertices in the mesh. Now my questions are:

  1. How does the HoloLens handle meshes? To get access to all vertices I need to loop first trough the mesh list and then trough every mesh to get them. Why does the Spatial Mapping Manager provide me with several meshes?

  2. In what coordinate frame are those vertices? If I want the relative distance from one vertex to the camera can I just subtract the camera position in world frame from the vertex position? Is the vertex in world frame?

Thank you very much for your time!

1

1 Answers

1
votes

The Spatial Mapping mesh will automatically be on layer 31, so with a simple layermask you can get it.

Why does the Spatial Mapping Manager provide me with several meshes?

Unity only handles meshes up to ~2^16 vertices/faces, so when it gets bigger than this it will be split up.

In what coordinate frame are those vertices?

As far as I know they are not in any special coordinate frame, just the normal unity-coordinates.

If I want the relative distance from one vertex to the camera can I just subtract the camera position in world frame from the vertex position?

Yes, I think a Vector3.Distance should work. You can get the position of your main camera with Camera.mainCamera.gameObject.transform.position.