Regarding ‘ARCore’ which is AR library released by Google, last time I introduced about ‘HelloAR’. It’s the most basic sample program of ARCore to realize AR environment on Android.
[Link: I tried ‘HelloAR’ sample of ‘ARCore’ Part1]
This time, I’ll explain how to set up ‘Cloud Anchors’ which is also one sample program released from ARCore 1.2 or later version.
The ‘Cloud Anchors’ is a library to realize AR multiplayer’s app sharing same AR environment with some devices. It means that due to realize same AR environment with some players, it provides a function to share the position information of real space with some mobile devices.
The above image is the final image of this sample program.
And this time, I referred following Google’s page for this post.
[Link: https://developers.google.com/ar/develop/unity/cloud-anchors/quickstart-unity-android]
[Overview of the operation steps]
1. Create API Key in Google Cloud Platform
1.1. Connect to Google Cloud Platform
1.2. Create new project
1.3. Enable ARCore Cloud Platform API
1.4. Create API Key
2. Download and Import ARCore SDK for Unity
2.1. Download ARCore SDK for Unity
2.2. Import ARCore SDK for Unity
3. Set up in Unity
3.1. Change platform for Android
3.2. Set up Player Settings
3.3. Set up Project Settings
4. Run on my mobile devices
4.1. Run as Host side
4.2. Run as Remote Client
[Used software version]
- Windows 10
- Unity 2017.4 (JDK and Android Studio should be installed beforehand.)
- ARCore SDK for Unity v1.4.0 (required v1.2 or later)
[1. Create API Key in Google Cloud Platform]
1.1. Connect to Google Cloud Platform
This ‘Cloud Anchors’ of ARCore is using Google Cloud to share a position information of an anchor. It means that firstly in Google cloud, one Host device save a position information of the anchor which is located in real space. Other devices get the position information from the Google Cloud, and identify the anchor’s position in real space.
Therefore, even simple sample program, definitely need to connect to Google Cloud to try this Cloud Anchors. And it’s necessary to get API Key of Google Cloud Platform to identify the app.
Firstly connect to Google Cloud Platform from following link. You can login by your Google account normally used for your Gmail.
[Link: https://cloud.google.com/]
1.2. Create new project
Create a new project in Google Cloud Platform. Input a new project name, and click ‘CREATE’ button.
Open the project just now created.
Open a menu by left top button, and click ‘APIs & Services’.
1.3. Enable ARCore Cloud Platform API
To add ‘Cloud Anchor API’ of ARCore to the project, click ‘+ENABLE APIS AND SERVICES’ located at the top of ‘APIs & Services’ screen.
Input ‘ARCore Cloud Anchor API’ into Search field at the top of the screen.
Filtered only one API, so click that one.
This is ‘ARCore Cloud Anchor API’ we need this time, click ‘ENABLE’ button to enable the API in the project.
‘ARCore Cloud Anchor API’ is enabled, and the screen is opened.
1.4. Create API Key
Click ‘Credentials’ in the left menu, and open Credentials screen. Click ‘Credentials in APIs & Services’ to create new Credentials.
Click ‘Create credentials’.
Click ‘API Key’.
API Key will be created and shown. It’s better to copy it, because you need to use it for Unity setting later.
[2. Download and Import ARCore SDK for Unity]
2.1. Download ARCore SDK for Unity
Firstly, download latest ‘ARCore SDK for Unity’ from GitHub. You can download the Unity Package from following link.
[Link: https://github.com/google-ar/arcore-unity-sdk/releases]
In this case ‘ARCore SDK for Unity v1.4.0’, click ‘accore-unity-sdk-v1.4.0.unitypackage’ to download. (Depending on version of the Unity Package, the screen will be changed.)
2.2. Import ARCore SDK for Unity
Next, open Unity Editor.
Import the Unity Package which was downloaded just now by selecting it from ‘Assets > Import Package > Custom Package…’.
Confirm selected all, click ‘Import’ button. Importing the package will be started.
After completion of the importing, you can start to use ARCore.
This time, I introduced a preparation for setting to use Cloud Anchor. Next time, I’ll explain how to set up in Unity editor and run it on 2 devices.
[Link: I tried ‘Cloud Anchors’ (A sample of ‘ARCore’) Part2]
[Original Japanese Site: http://blog.lab7.biz/archives/11599487.html]