AR SELECTION INTERACTION | AR TRANSLATION INTERACTABLE | AR SCALE INTERACTABLE | AR ROTATION INTERACTABLE

Unity AR Virtual Object Selection & Customization

Add Feature that Allows Users to Select and Customize Virtual Objects

Jordan T Kay
3 min readJun 26, 2024

--

STEPS NEEDED

  1. AR Selection Interaction Component | PlacementPrefab Prefab
  2. AR Translation Interactable Component | PlacementPrefab Prefab
  3. AR Scale Interactable Component | PlacementPrefab Prefab
  4. AR Rotation Interactable Component | PlacementPrefab Prefab

STEP ONE — AR Selection Interaction Component | PlacementPrefab

PLACEMENTPREFAB > Add Component > AR Selection Interactable

AR Selection Interactable Component controls the selection of an object via a tap gesture.

Define Colliders: Child Cube GameObject → Defines the hitbox for raycasting
Select Mode: Single → Only allows selection of 1 object at a time
Selection Visualization: Child SelectionVis GameObject → GameObject is enabled/disabled when the interactor is selected/deselected

STEP TWO — AR Translation Interactable Component | PlacementPrefab

PLACEMENTPREFAB > Add Component > AR Translation Interactable

AR Translation Interactable Component manipulates the position of an object via a single point drag gesture. If an object is not selected, the object will be when the drag gesture starts.

Define Colliders: Child Cube GameObject → Defines the hitbox for raycasting
— Translation Mode: Horizontal → Controls whether the object will be constrained vertically, horizontally, or free to move in all axes

STEP THREE — AR Scale Interactable Component | PlacementPrefab

PLACEMENTPREFAB > Add Component > AR Scale Interactable

AR Scale Interactable Component controls the scale of an object via a pinch gesture. If an object is selected, then doing a pinch/zoom gesture will modify the scale of the project.

Define Colliders: Child Cube GameObject → Defines the hitbox for raycasting
Min Scale: 1 → Smallest value user is allowed to scale object to
— Max Scale: 2 →
Largest value user is allowed to scale object to
Elastic Ratio Limit: .2 → defines the maximum extent the which the scaling can EXCEED its defined boundaries due to an elastic effect. A value of .2 means the object can stretch up to 20% beyond its min/max scale boundary.
— Sensitivity: .75 → Controls how responsive the scaling interaction is to user input. High sensitivity means small movements results in significant changes in scale. Low sensitivity requires larger movements to achieve the same change.
— Elasticity: .15 →
controls the amount of “bounce back” after the object hits the min/max scaling limit. High elasticity means the object will stretch noticeably beyond its limit and then spring back more drastically. Low elasticity means the object will have a subtler stretch and bounce back effect.

STEP FOUR — AR Rotation Interactable Component | PlacementPrefab

PLACEMENTPREFAB > Add Component > AR Rotation Interactable

AR Rotation Interactable Component manipulates the rotation of an object via a 2 point drag/twist gesture.

Define Colliders: Child Cube GameObject → Defines the hitbox for raycasting

TEST

--

--

Jordan T Kay

Join my journey into game development with Unity. Learning all I can to produce quality games. 🚀