Creation
A player controller is created the same way all classes are created
- Generate a class using the Build Tool
- Include that class' header into a game mode's header
- In the game mode's constructor, use the standard make function
- You have a player controller ready to go
Usage
A player controller is a simple class, that contains the standard events, but also has a pointer to a Pawn. Conceptually, the Player Controller acts as the "soul" of the player, meaning its main job is switching between different pawns in the world.
To change into a new pawn that is already instantiated, you can use
the void posess(Pawn* pw)
function. If a pawn is not yet
spawned you are going to need to use the makePawn
function
and call the begin
it's begin event in order to create a
new pawn, after that you can call the possess function as before.
Just like the Level
or GameMode
the player
controller also has the standard autohandle
functions for
calling the pawn's events
Casting
You can use the standard cast function to cast between a generic pointer type to it's base type
- Home
- Beginner concepts
- Advanced concepts
- Engine developer and contributor resources