Game Development Reference
In-Depth Information
How it works...
NavMeshes use a Scout class to determine its default properties for things such as height. If
any pawn we use on our map has a larger collision cylinder than the scout, then it will not able
to successfully pathfind and make use of our NavMeshes.
By creating our own Scout class and altering its properties so that it allows for larger pawns
on the map, we can avoid potential errors in the future. To ensure that the engine makes use
of our custom Scout class we needed to make a change to the DefaultEngine.ini ile
with the editor.
Adding an AI pawn via Kismet
With our means for navigating a level out of the way, we can finally work on adding a pawn
who will take advantage of the things we've built, and allow the pawn to wander around the
level. Later on we're even going to add functionality so that it follows us around the map.
Getting ready
We're going to create a new bot, which is really just an AI controller for pathfinding, by
extending from UDKBot.
Class TutBot extends UDKBot;
As we move along, we'll begin to add more functionality to it such as the ability to wander
using the PathNodes or NavMeshes, as well as follow our pawn.
How to do it...
One of Kismet's many useful functions is the ability to spawn bots and pawns. In Chapter 8 ,
Miscellaneous Recipes we'll cover how to do spawn objects from code, but for now we'll stick
to Kismet. This recipe
is one that we'll have to use frequently throughout the rest of this chapter as well.
As always, we'll want to add debugging information. This is more important than ever,
as there are a number of things that could go wrong within this class and which may
cause confusion. Start by adding a simple log function that allows us to see whether
or not our pawn is ever even spawned.
/** Lets us know that the class is being called, for
debugging purposes */
simulated event PostBeginPlay()
Search Nedrilad ::

Custom Search