How to change an AR Object in Unity — Translation, Rotation and Scale

Paul Killman
Antaeus AR
Published in
5 min readFeb 29, 2024

The Unity Manual on the XR Interaction Toolkit gives details on how to translate, rotate and scale AR objects and what components are necessary to do so. Below is a table of the various gestures that the Toolkit recognizes.

This article is adding to the project described in previous articles I’ve written on placing AR objects and selecting AR objects.

I have a Placement Prefab that I use to demonstrate how to place and select AR objects.

You will notice that it already has an AR Selection Interactable component added to it. This is what allows the prefab to be selected. As you can probably guess, we’ll be adding more components to the prefab that will allow it to be moved — (translated), rotated and scaled.

We’ll begin by adding an AR Translation Interactable.

We won’t be able to drag the Interaction Manager or XR Origin to this component because it's a prefab and not part of the current scene. We can however add the collider by dragging the Red Cube into the Collider field. (The Red Cube is the actual 3D object that you see on the screen. It has the collider on it.)

You can also choose the Object Gesture Translation Mode. Since my project is only set up to recognize horizontal planes, I have this set to Horizontal.

You can also limit how far an object is allowed to be moved. I’m leaving it at its default value of 10.

That’s it. It’s now ready to test. (As I stated in a previous article, the simulator does not work properly with AR Interactables, so I have to build the project and install it on my mobile device.)

Place
Select
Translate

The AR Scale Interactable allows you to increase/decrease the size of the AR object. I added this component to the Placement Prefab, just like I added the translation component earlier.

I added the Red Cube to the Colliders field.

I changed the Min and Max scale values to make it very easy to see that I scaled the object.

That’s it. I built the project and put it on my mobile device.

Placed
Selected
Scaled

If you wish to polish things up a little, you can play with the Elastic Ratio Limit and Elasticity values. You can make the scaling, ‘bouncy’, if you wish, where the object will scale past the set value and then ‘bounce’ back to the min/max value.

Our last AR Interaction on AR Objects is rotation. As you can probably guess, we add an AR Rotation Interactable to our Placement Prefab.

As with the previous components, I added the Red Cube to the Collider.

The rest of this should work out of the box. There are a couple of settings that we can play with — Rotation Rate Degrees Drag and Rotation Rate Degrees Twist. The Unity Manual was not very helpful on what exactly these values represent.

I didn’t change the values, I just built the project and played with rotating an AR Object.

Place
Select
Scale and Rotate

I scaled the AR Object to make it easier to work with. I found that I could rotate the selected object by making the twist gesture with two fingers or by dragging one finger to the side of the object.

This completes this article on the basic AR Interactions available in Unity.

--

--