whycodingsohard
whycodingsohard

Reputation: 225

Microsoft Hololens Spatial Mapping Surface Differentiation

I am wondering about the capabilities of the HoloLens to differentiate between surfaces. More specifically, I would like to know what type of surface the user is gazing at, be it a horizontal surface (i.e. a table top, floor, ceiling) or a vertical surface (i.e. walls). I am wondering if there is any built in function in detecting this or how I can go about implementing one -which I am not too sure of where to start. (I have been googling for quite a while now to no avail.)

Upvotes: 0

Views: 496

Answers (2)

Cameron Vetter
Cameron Vetter

Reputation: 747

The other ideas will work, but are missing the point of what Microsoft has provided. You should use either the HoloToolkit (Direct3d / C++) or the HoloToolkit for Unity (Unity3d / C#).

https://github.com/microsoft/HoloToolkit

https://github.com/microsoft/HoloToolkit-Unity

Each of these have the concepts of

SpatialMapping + PlaneFinding:

https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit/SpatialMapping

https://github.com/Microsoft/HoloToolkit/tree/master/SpatialMapping/PlaneFinding

and

SpatialMapping + SpatialUnderstanding:

https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit/SpatialUnderstanding

https://github.com/Microsoft/HoloToolkit/tree/master/SpatialUnderstanding/Src

Plane Finding will do what you are looking for, but Spatial Understanding may provide a level of sophistication that helps you better accomplish your goals. Either way, work smart and use the SDK's Microsoft has provided.

Upvotes: 2

Everts
Everts

Reputation: 10701

Use a raycast onto the mapping, then use the normal from the RaycastHit object.

https://docs.unity3d.com/ScriptReference/RaycastHit-normal.html

Then compare the normal with Dot product to the Up vector. If close to 1, then you have a horizontal surface, if close to 0, you have a vertical surface.

Upvotes: 0

Related Questions