Game Development Reference
In-Depth Information
// Then set it back to zero and begin again
_PathNode = 0;
// Go to the Pathfinding state
The PathFinding state has the prefix Auto to denote that this is the default
state the bot will start in. It checks if there are PathNodes in our array, and if there
is one, starts moving towards it.
We use the function MoveToward() as it accepts an actor as a
parameter, and therefore we begin to move toward the actor. If we
wanted to use a vector instead, we would use the MoveTo() function.
* Auto state for our PathNode navigation.
auto state Pathfinding
// Move to PathNode if one exists
if (WayPoints[_PathNode] != None)
MoveToward(WayPoints[_PathNode], WayPoints[_PathNode],
7. The final bit to add is in the default properties block. CloseEnough is the integer
we used earlier, and we've seen bIsPlayer before as well.
// Once we're within this man UU's of our Node....
CloseEnough = 200
// Pawn is a player or a player-bot
bIsplayer = True
Load up our Ch5_PathNodes2.udk map, set Kismet to use our new controller and
watch as the bot wanders from PathNode to PathNode in the same order you laid the
nodes on the map!
Search Nedrilad ::

Custom Search