UnrealScript Game Programming Cookbook

(Chris Devlin) #1

AI and Navigation


122

If we were to ever use a pawn whose height is greater than that of the scout's NavMesh, then
upon spawning into a map, the pawn would instantly fall asleep and refuse to move. We're
going to resolve this before it ever becomes an issue by creating our own Scout class.


Getting ready


We're going to extend from Scout.uc and create our own version of the Scout class. This
Scout class is essentially what UDK uses for measuring how high the walls need to be in
order to be used by the engine's navigation system. If our scout class is smaller than the size
of our pawn, then the pawn will not be able to maneuver around the map correctly, as the
maximum wall height recognized by our navigation image is based on the height of our scout.


Start off by creating a new class called TutScout and have it extend from Scout.


class TutScout extends Scout;

We're ready to begin working on our new class.


How to do it...


We're only going to alter the default properties for our custom Scout class, as all of the
methods inside of it suit our needs well.



  1. In your default properties, add the following code:
    defaultproperties
    {
    PathSizes.Empty
    /* Clears out any paths that may previously have been
    there. We will be using the size of our pawn as a
    template for how tall and wide our paths should
    be
    /
    PathSizes.Add((Desc=Human,Radius=180,Height=330))
    NavMeshGen_EntityHalfHeight=165


/** Subtract this from our MaxPolyHeight to get the final
height for our NavMesh bounds */
NavMeshGen_StartingHeightOffset=140

/** This number needs to be larger than the size of your
default pawn */
NavMeshGen_MaxPolyHeight=175
}
Free download pdf