O'Reilly logo

C# Game Programming Cookbook for Unity 3D by Jeff W. Murray

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

Chapter 7

Recipe: Waypoints Manager

7.1 Waypoint System

Both the racing game Motor Vehicle Doom and the shoot ’em up Interstellar Paranoids will need waypoints for the AI players. In Motor Vehicle Doom, we use waypoints for the AI and also for the main player for the following reasons:

  1. To check that the main player is heading in the right direction. The car controller code will track the player’s position on the track (based on which waypoint has been passed) and check its forward vector to make sure that it is facing the next waypoint along the track. If the player’s forward vector is not within a certain tolerance angle, the game will ...

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