Working with AR Interactable.
Objective: Working with AR Interactable.
Before doing anything we need to understand what we want to do ,we need to have ability to place object in the world.
This means we fire a ray to a plane then we place an object to a plane, then we can specify what we want to do to that object we placed into the plane.
To do this we need to add AR RayCast Manager to the same game Object of XR Origin.
Now we need to add AR Placement Interactable ,go to the hierarchy hit plus button <XR<AR Placement Interactable.
We need to create Object when ray hit a plane, so I will create a cube with parent. Then I will offset the child game Object so it will be Instantiated in correct position. Then turn cube(Placement_Prefab) as prefab ,select AR Placement Interactable<Inspector, drag and drop cube(placement prefab) to the field of Placement Prefab.
Note: I set a scale of child object to 0.1 which is equal to 10 centimeter
To tell that user touch pinch a screen we need to add AR Gesture Interactable, this will fire a ray and choose what to do according to the Input.
Important! AR Gesture Interactable need to be added into the Main Camera.
In addition Its best practice to add XR Origin and XR Interaction Manager to the Inspector into AR Gesture Interactor. Although this will be search automatic when the app is running.
If Play the editor to try this feature in XR Simulation ,AR Placement wont work ,their working on this issue.
Note: This will work when you build the app to android device.
See you into the next article.