Last time, I explained how to set up ‘HelloAR’ which is the most basic sample of ARCore SDK. This time, I’ll introduced the result of executing the sample, and how to change the 3D model (Google’s Andy) which is set up as standard prefab of ARCore sample like the above image.
[Link: I tried ‘HelloAR’ sample of ‘ARCore’ Part1]
[3. Run on your mobile phone]
Connect to Android device by USB cable. (Beforehand, need to turn on for USB debugging on the Android device.)
Click ‘Build And Run’ to start to build and install the app to your device. Anything is ok for the file name.
Open the app on your Android device, and start to search some plains in a screen with showing ‘Searching for surfaces…’.
If the app find a plain, appear a mesh on the location like following image.
Let’s try to tap on any places where the meshes are shown. Google’s character Andy will appear.
4. Change Google character Andy to another
4.1. Prepare another 3D model
For this ARCore sample ‘HelloAR’, Google’s character Andy 3D model will be appeared at the location you tapped. Let’s try to change the 3D model to other model you like.
This time, I used SD Unity-chan which is a character Unity Japan created. (You can download the asset freely.) And you can also select anything, so beforehand please prepare a 3D model you like.
Drag and Drop the 3D model to Hierarchy view of Unity editor.
Click the 3D model (game object) in Hierarchy view, and adjust Scale of the 3D model referring to Andy’s size. Andy is a little bit small, so it’s better to adjust to make your 3D model bigger than Andy.
Here, I adjusted the scale like following image. Due to make the 3D model to face a camera, you also need to change the Rotation for Y dimension to be 180.
By doing drag and drop this 3D model (game object) from Hierarchy view to Project view, make it to become Prefab.
Delete the 3D model (game object) in Hierarchy view.
4.2. Change to another 3D model
Click ‘ExampleController’ game object in Hierarchy view of Unity editor. Drag and drop the Prefab just now you created from Project view to ‘Andy Plane Prefab’ item of ‘Hello AR Controller’ script in Inspector view.
4.3. Run on your mobile phone
Ok, finished the setting to change the 3D model. Next, let’s try to build and run on your mobile device. As explained in the last chapter, click ‘Build And Run’ in Build Settings screen.
This time, Unity-chan appeared instead of Andy.
Because this sample program is created very well, you can create AR app very easily. When you develop your own AR app, you can understand ARCore very easily and deeply by confirming the sample’s details and scripts.
[Original Japanese Site: http://blog.lab7.biz/archives/11520468.html]