O'Reilly logo

UnrealScript Game Programming Cookbook by Dave Voyles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making a pawn follow us around the map with NavMeshes

We started to see the benefit of using NavMeshes with our last recipe, as it allowed our bot to determine whether or not a destination was reachable before it began to move to it.

Now we're going to take it to the next step, and have our bot follow us around the map. This time however, when the bot detects that we are too far away, or it can't reach us directly, it will create a path of its own to reach us.

Getting ready

Open your IDE and prepare to create a new class.

How to do it...

We've covered enough wandering and patrolling up to this point. Why not create an AI which is more friendly, and can follow us around a map? I'm sure you've played a game where one character follows another, whether ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required