Game Development Reference
In-Depth Information
6. Now, when you run the scene, assuming it is lit up and has the camera point-
ing where you want it to, you'll see NPC on Terrain .
7. Click somewhere on the Terrain object, and watch the NPC object move to
that point.
8. Although we might say that the pathfinding in this is clearly working, we
should also add an obstacle to the scene: something that shouldn't be
stepped on. To do this, add another cube somewhere. Go to the Inspector
panel for the obstacle and tag it with Obstacle by selecting that tag from the
drop-down, or if it is not an option select Add Tag... and add Obstacle to
the tag list.
9. Next, in the Terrain game object, in the Grid component, expand Disal-
lowed Tags , increase the size to 1 and enter Obstacle for the new element.
10. Next, click on the Bake button at the top of the Grid component. Now you
will see that the grid markers skipped the cube as an option. If you want to
test more, click somewhere else on the Terrain object and watch the NPC
object move to the clicked point avoiding the obstacle.
Search WWH ::




Custom Search