Procedurally placing our bin

In the previous chapter, we had the user explicitly place the bin. This was achieved by having the bin follow the user's gaze, positioning itself on valid surfaces, and setting its position after detecting an air tap from the user. In this chapter, we will bypass the user completely and place the bin automatically.

To be able to place the bin, at a reasonable location, we first need to better understand the environment. Similar to how we interpret the world through objects rather than pixels, essentially we need a way to express the environment in a more meaningful way than the mesh data we receive from the SurfaceObserver to be able to effectively place the bin procedurally, for example, recognizing a surface as being the floor, where bins normally reside. Luckily, HoloToolkit provides us with the necessary tools to achieve this and we will spend the rest of this section, and a significant amount of this chapter, exploring two different approaches. The first will be using the utility class SurfaceMeshesToPlanes.

This utility converts surface mesh into a set of planes, tagging each with metadata defining the type of surface the plane belongs to, such as wall, floor, table, or ceiling. The second approach will be using the package SpatialUnderstanding, a helpful library that allows us to interrogate and search for places that adhere to a set of specified constraints.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.182.179