Add new AR Objects
Last updated
Last updated
From this chapter we are looking at how to add new AR objects to your app. Follow the easy steps below.
3D model
Icon of 3D model (It’s good to have but not required)
1. Go Assets->AReality Placer ->Scenes folder and double tap on AR scene to load the scene. (Fig. 1)
2. Go to Assets-> AReality Placer -> Meshes folder. (Fig. 2)
3. Drag and drop your 3D model to this folder. (For our case we added a 3D car model to meshes folder) (Fig. 3)
4. In the hierarchy window, right click then select Create Empty. (Fig 4)
5. Select Empty game object and rename it to your 3D object’s name. In our case Car. Then change click 3 dots next to transform and click reset to reset the transform.
6. Then drag and drop your imported 3d model into the new empty object. In our case the car object to empty object just created. (Fig. 6)
7. Then it looks like this. The Car 3D model is a child of the empty car game object. Double tap on Car empty object to focus the object. (Fig 7)
8. Select Car parent object, in inspector click add component. Select Box Collider (Fig 8). (According to object you can add any collider you want)
9. Click Edit collider button under collider component. Then it will appear green box on your 3D model. Edit it by dragging small green dots to adjust the size of collider same as object size.
10. Click the 2D button in the scene. It will exit 2D view from the scene. Then it will show a side view of your object. From that view you can adjust the collider box further height and length of object.
11. Once you adjust the collider box, Go to Assets-> AReality Placer -> Prefabs folder. Drag and drop Car parent gameobject into this prefabs folder. (Fig. 11)
12. Now delete Car object from hierarchy window. Right click on Car object in hierarchy window and click delete option in the menu. (Fig. 12)
13. Then select Object Handler gameobject in hierarchy window. In inspector you can see all 5 objects currently show in our app. You can remove objects if you don’t want by select object and click – icon on right bottom corner. For demonstration We remove all these objects. (Fig. 13)
14. Then we click this plus (+) button to add new AR object. (Fig 14)
15. Then we drag and drop our Car prefab from prefab folder to Placement object. Change the Name of our object “Car”. To add the icon click circle next to object icon. Then search for your icon and select it. (Fig 15)
16. Now you can build the app and see the result. You can see the object under AR objects in the app. Click the button when the target appears. It will show your object. (Fig. 16)