AR -Image Targeting Spawn Enemies Towers & Firing Towards Mini-Robot…!!
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
- To track images — created a ReferenceImageLibrary
- 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.
- Similarly created prefab for cannonball with the script - destroy the player when hit.
- At last, included a Game script to keep track of the game variables, update our UI, and handle the game overstate as below.
Here finally Image Targeting Spawn Enemies Towers and firing towards AR Mini-Robot