LocationDemo - Experiences And Maps
Creating a Location demo using the Appearition SDK for Unity
Location Demo v1.2
Appearition SDK v0.3.0
17th February 2019
Description of Project#
The objective of this project is to create a location demo using the Appearition SDK, as well as the EMS. The application should be able to display a map, the user’s current location, as well as location data coming from the EMS.
Additionally, the demo should be able to display data relevant to the points of interest selected by the user.
Requirements And Prerequisites#
This project requires the following:
An understanding of the Appearition SDK (please refer to the developer website for tutorials)
Appearition SDK v0.2.5 or newer
Unity 2017.3.1 or newer
Access to the EMS’s Location and ArExperience modules
1.0 - Start a new project#
To begin with, start a new Unity project using Unity 2017 LTS.
2.0 - Understanding the data structure on the EMS and application#
This demo uses both the Google Static API, as well as the EMS. Here is a chart explaining roughly the kind of structure implemented in this demo.
The Location module of the SDK provides information related to Point Of Interest (POI), as well as a label which we are using to display a point on the map.
Additionally, we are using the ArExperience module in order to store media. We are binding the Location data to the ArExperience data using the name in each module.
On the Google side, we use the Google Geolocation API to get the current user location. If the user is using a mobile, we’re using Unity’s geolocation utility to get that information from the phone’s feature.
Lastly, we use Google’s Static Map API in order to get a map, given geolocation and additional parameters, and use that to display the map on the screen. The Google Static Map API is fairly complex and customizable, so it’s possible to stylize your map the way you want to.
Please note that in order to use Google API, you must provide your own Google API developer key, and any charge that apply is your responsibility.
3.0 - Create Location data on the EMS#
In order to create Location data, you first need to head to the Appearition EMS Portal, and login.
Once done, click on your channel, and go to Ar Locations
Click on Add AR Location to add more content
Since we are binding the Location Experience with the AR Experience by name, the names need to match!
Then, create a GPS Location. One of the strengths of the EMS is the Website’s UI, which enables non-programmers to add content easily. You can add a location by typing the address of the place.
Then, finally, add a label. That label will be used on the map at the location pointed by the location data, and will be used as a button to play the experience bound to this location experience.
Make sure that the Information Panel is toggled off, otherwise the EMS will not let you publish this experience. Finally, click publish, and you’re all set!
3.1 - Create Experiences on the EMS#
Now that the Location data is created, we can create some experiences as well. Do note that the order doesn’t matter, I just prefer creating location first.
Head back to the channel selection, and this time, click on AR Experience.
And create an experience for it. Remember, the name needs to match the Location experience’s name.
For this case, we are not using any Ar Target. We are using the Ar Experience as data to use in the application, so we can leave the Target blank. All we care about is the Media.
Upload a new media to get started!
And finally, publish the experience.
And that’s it. The EMS side of the demo is complete, and the data is ready.
4.0 - Setting up Google API#
For the purpose of this demonstration, we’ve used the Google API, but for your own use, you can decide not to use it and create your own Maps implementation as part of the demo.
In order for this demo to work, you will need to create your own Google API developer key. Please head over to the Google developer website to create an account.
The two modules that are required for this demo are:
In order to achieve that, click on the Get Started button on the top right, and follow the instructions. We will only need the MAPS module from the Static Map API, but it doesn’t hurt to take all of them.
5.0 - Setting up the SDK#
Firstly, create a new project, and import the Appearition SDk v0.2.5 or newer. Then, fetch the Location Demo unitypackage, and drop it as well. Both of them are available on the Appearition developer website.
Open the Location_Main scene, which should be located under Appearition/Example/LocationDemo/Scenes/Location_Main.scene.
You should be greeted with several objects on the scene, including the AppearitionManagerLocationDemo, which contains the Appearition Gate, as well as other components related to the demo.
To begin with, enter your EMS information in the Appearition Gate, as well as your Google API key inside the AppearitionLocationDemoHandler script.
Once complete, you’re ready to go! You can press play and see what happens!
6.0 - The demo#
To begin with, the loading time for this demo is larger than usually, the application will fetch the locations, then the ar experiences, and then the geolocation. Those three steps can be handled in parallel, but for the sake of this demo, I’ve kept it simple.
You can navigate on the map using the touch input (move finger to move, and pinch to zoom in), or using the arrows and mouse scroll.
If you move further than the maps have been generated, new maps will be generated. So you technically can walk endlessly and rotate around the earth; although you won’t find many experiences if you do!
Here is what the demo looks like at work:
7.0 - The demo’s code structure, and how to expand it#
The project structure can be explained using this chart:
If you want to implement any additional MediaType, you will need to create a new class called \<Mediatype>LocationMedia (eg AssetbundleLocationMedia). Additionally, if you want to instantiate a prefab instead, place a prefab with the same name as the mediatype in the folder Appearition/Example/LocationDemo/Resources/LocationPrefabs/.
If you have any question, please contact the Appearition Support Team.
Thank you and have a wonderful day!