Creation
- Create the class using the BuildTool
- Include the class' header into a player controller's header
- Use the standard make function
- You have a Pawn ready to go
Usage
Pawns are objects in the scene containing a camera, they are used to represent a player's character in the world. They are controlled by a player controller, and it can switch between them on demand. Semantically, pawns should control player input and player specific state only, related to the pawn or the physical player character, since state like scores should be kept under the player state class.
Using pawns requires you use the 3 standard events.
It should be noted here that the constructor should only be used for
setting the id
, name
and devName
parameters. Everything else including initializing the camera and
caching components of an actor should be done in the begin
function.
Apart from that the actor stored in the pawn as a member should also be a valid entity and should not be destroyed in the destructor, since the inherited destructor calls destroy on it automatically
Due to the pawn being a critical component of the scene, there are
also safeguards for when you are destroying it. If you call
destroyPawn
and pass in the current pawn, the engine will
throw and error and switch you to a fallback pawn.
Casting
Pawns, like any other types, use the standard cast function to convert generic pointer types into their base type
- Home
- Beginner concepts
- Advanced concepts
- Engine developer and contributor resources