AR -Image Targeting Spawn Enemies Towers & Firing Towards Mini-Robot…!!

Anurag Chawla
2 min readOct 8, 2021

--

In the last article, designed and implemented our AR Mini- Robot that used detected horizontal planes in the real world to spawn and move along with Joystick Controller.

Here we added a new feature — added image target tracking to spawn enemies towers in the game, and adding some simple AI to them to track the player.

Assets used for the Enemies Tower as under

Steps were taken into consideration:

  • In AR Session Origin — added an AR Tracked Image Manager
Added an AR Tracked Image Manager
  • To track images — created a ReferenceImageLibrary
Added Two -Image targets for Towers
  • Created a prefab for our tower to spawn when an image target was detected along with Tower script with the player tracking AI with shooting logic- used a coroutine to handle the firing of cannonballs at the player.
Added Prefabs — Tower and Cannonball
  • Similarly created prefab for cannonball with the script - destroy the player when hit.
Tower and Cannonball — Scripts
  • At last, included a Game script to keep track of the game variables, update our UI, and handle the game overstate as below.
Game Manager — Script

Here finally Image Targeting Spawn Enemies Towers and firing towards AR Mini-Robot

AR -Image Targeting Spawn Enemies Towers & firing towards Mini-Robot

--

--

Anurag Chawla
Anurag Chawla

Written by Anurag Chawla

Emerging Technologies - Power Virtual Agents | AI Chatbots | Multi-Cloud & DevOps | UI Technologies - React , Angular | Gaming Technolgies - Unity, XR- AR/VR

No responses yet