PlayerController

The Controller class has two main child classes: PlayerController and AIController. The PlayerController class is used by human players, while the AIController class uses AI to control the Pawn.

The Pawn and Character classes only receive input Events if PlayerController is possessing them. Input Events can be placed on PlayerController or Pawn. The advantage of putting the input Events in PlayerController is that these Events become independent of the Pawn, making it easier to change a Pawn class that is being possessed by the Controller class.

The following screenshot shows how to change a Pawn possessed by PlayerController in-game, and shows the use of the Possess Function. In this example, there are two characters in the Level that can be controlled by the player by pressing the 1 or 2 keys. Only the Character class currently being possessed receives the PlayerController commands:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset