Point-and-click move to tile
Rather than clicking specific objects to indicate the target for our AI-controlled agent, we can create a grid of 3D plane (tile) objects to allow the player to click any tile to indicate a destination for the AI controller character.
So, any location can be clicked, rather than only one of a few specific objects:
Figure 12.8: Example of point-and-click move to tile with a 3D plane grid
Getting ready
This recipe adds to the previous one, so make a copy of that project folder and do your work for this recipe with that copy.
For this recipe, we have prepared a red-outlined black square texture image named square_outline.png
in a folder named Textures
in the 12_04
folder.
How to do it...
To create a point-and-click game by setting GameObjects to a selected tile, do the following:
- Delete your 3D cube, sphere, and cylinder GameObjects from the scene.
- Remove the script component
ArrowNCPMovment
from theSphere...