Tap to Place in the World — Placing Objects in Unity AR During Runtime

Paul Killman
Antaeus AR
Published in
3 min readFeb 26, 2024

In this article, I will show the steps I used to place AR objects using Unity. This article assumes that plane detection is already set up.

The first step is to add an AR Placement Interactable to the scene.

Add XR Origin to the AR Placement Interactable.

Create Placement Prefab — I created a cube and changed its material to red and I scaled it down to 0.2 on all three axes.

I made the cube a prefab and deleted it from the scene. I then added the prefab to the AR Placement Interactable.

Add an AR Gesture Interactor to Main Camera. (Main Camera is a child of the XR Origin.)

Add Interaction Manager and XR Origin to AR Gesture Interactor

AR Gesture Interactor detects when the screen is tapped, and it talks to the AR Placement Interactable. (This CANNOT be tested using the XR Simulator. It doesn’t work.)

Since the XR Simulator doesn’t work, I built the project and tried it on my phone. Initially I couldn’t get it to work, but then I realized that I have to tap on a plane.

I was able to place red cubes into the AR world by tapping the screen. The cool thing is, the cubes stay in the same place in the physical world, even when I move the phone around.

--

--