Augmented Reality (AR) has become a fascinating manifestation of the fusion between the digital and the real world.
An adaptation of the video game Tanks! from Unite Training Day 2015 to AR has been made.
AR Foundation in Unity has been used for this purpose, leveraging the native AR SDK of the platform. Unity also supports the Google ARCore XR Plug-in on Android.
In an augmented reality scene using AR foundation, we need to include an AR Session (in XR -> AR Session) and an AR Session Origin (in XR -> AR Session Origin).
The function of the AR Session is to maintain the AR components within the application, with this we can pause, reset or reactivate the AR elements of the mobile phone.
AR Session Origin enables the positioning of the device in the world and transforms real-world elements into the unity scene. When we move in the real world, the unity scene starts to move the AR Camera.
We have some other tools from AR Foundation like:
We will use all the level art of the game to be instantiated by MakeAppearOnPlane script.
Sliders are also added to the interface allowing to rotate and scale the game level.
Some inputs have been added to work on Android mobiles. We will use them to move and shoot with the tank.
Here are some screenshots: