Unity Learn home
View Tutorial Content
Steps

Manipulating Objects in AR with Lean Touch

Tutorial
Intermediate
10 Mins
(72)
Summary
Lean Touch is an asset available in the Unity Asset Store that makes scaling and rotating objects in AR easy. In this tutorial, we’ll apply the Lean Touch script. We assume that you’re starting this tutorial with an open project that places or loads objects into an AR scene.
Related documentation
Select your Unity version
Last updated: March 14, 2021
2019.4
2019.3
2019.2
2019.1
Language
English

1.Manipulating Objects in AR with Lean Touch

This tutorial has been verified using Unity 2019 LTS and Lean Touch v.2.1.8
Lean Touch, available in the Unity Asset Store, makes scaling and rotating objects in AR easy. In this tutorial, we’ll apply the Lean Touch script. We assume that you’re starting this tutorial with an AR-ready project that has at least one pre-placed object that you wish to manipulate in an AR Scene.
1. Download and import the Lean Touch Asset from the Asset Store.
2. From the GameObject drop-down, select Create Empty to create an empty GameObject in the Scene. Name it LeanTouch.
3. Attach the Lean Touch component to the LeanTouch GameObject.
4. Attach the Lean Select component to the LeanTouch GameObject.
5. Set the Camera field in the Lean Select component to the camera in your Scene (Figure 01).
Select image to expand
Figure 01: Setting the Camera field on the LeanTouch object
6. Attach the Lean Finger Down component to the LeanTouch GameObject.
7. Open Show Unused Events in the Lean Finger Down component and drag the LeanTouch object into the field under On Finger (LeanFinger).
8. Set the drop-down to LeanSelect.SelectScreenPosition (Figure 02).
Select image to expand
Figure 02: Setting the Event for your Lean Finger Down component
9. For any object in your Scene that you want to manipulate, add the following components:
a. Lean Selectable
b. Lean Twist Rotate Axis
c. Lean Pinch Scale
d. Lean Drag Translate 10. Enable Deselect On Up in the Lean Selectable component. This will make sure you are only manipulating one object at a time.
11. Set the Camera field in the Lean Drag Translate component to the camera in your Scene. This will lock the translation movement to the Scene camera and avoid any movement speed issues (Figure 03).
Select image to expand
Figure 03: The completed setup for your in-scene object
12. Build and deploy the project to your mobile device.
Try tapping and dragging an object in the Scene. Try holding one finger in place on the object while another finger moves away and toward the first to scale the object. Hold one finger in place on the object while another moves in a circle to scale and rotate the object.

2.Conclusion

Lean Touch makes interacting with AR objects as natural as interacting with images using the same gestures on mobile devices that have been standard for years.

Manipulating Objects in AR with Lean Touch
Manipulating Objects in AR with Lean Touch
General Tutorial Discussion
0
0
1. Manipulating Objects in AR with Lean Touch
0
2
2. Conclusion
0
1