Creating an AR furniture previewer by detecting horizontal planes
As we saw in the previous recipe, one of the features of AR is its ability to detect flat surfaces through device cameras and other sensors (such as the LIDAR sensors on some high-end iPads and iPhones). This recipe will illustrate how a Unity raycast, combined with some AR Foundation objects and scripts, lets us create a basic AR furniture previewer just by tapping on the screen where we want a virtual 3D piece of furniture to be displayed.
Figure 17.22: Adding 3D sofas to a back yard
Getting ready
This recipe builds upon the previous recipe, so make a copy of that project to work on in this recipe.
We’ll be making use of a free model from the Unity Asset Store, which can be found here:
How to do it...
To create an AR furniture previewer, do the following:
- In the Hierarchy panel...