From the course: AR Development Techniques 02: Lighting and Physics
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Tap on screen to place on plane: Part 1
From the course: AR Development Techniques 02: Lighting and Physics
Tap on screen to place on plane: Part 1
- [Tutor] In the previous video, we set up plane detection. In this video, we are going to write some code to anchor or place a virtual object on that detected plane surface when the user taps on the screen. First let's understand how exactly does object placement work. When the user taps on the phone screen, an invisible virtual raycast is projected from the device into the real world. The point where the raycast and the detected plane meets is where the virtual object gets placed or instantiated. Let me show you an example. So when the user taps on the screen, an invisible raycast is projected from the screen into the real world. The point where that raycast meets the detected plane is where this virtual cube will be instantiated. So inside the code, we have to do three things. First, detect the user touch, that is, when the user taps on the screen. Second, project a raycast. And third, instantiate a virtual cube at the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Plane detection overview1m
-
ARSession and ARSessionOrigin2m 10s
-
Point clouds and plane detection3m 40s
-
Deploying the app on your devices2m 50s
-
Tap on screen to place on plane: Part 13m 8s
-
Tap on screen to place on plane: Part 24m 28s
-
Tap on screen to place on plane: Part 34m
-
Hiding plane visualizers2m 8s
-
FocusSquare to place on plane13m 40s
-
Resetting and reloading the ARSession2m 43s
-
-
-
-
-
-