A player controller is created the same way all classes are created
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
You can use the standard cast function to cast between a generic pointer type to it’s base type