In this lesson, you will learn how the Pawn class acts as the physical bridge between raw player input and the simulated game world.
The Pawn as a Physical Vessel
In Unreal Engine’s framework, an Actor is just an object that exists in the world, but it doesn't know how to "listen" to a player. The Pawn class is a specialized type of Actor designed specifically to be "possessed."
Think of the Pawn as a physical vehicle or a body waiting for a pilot. By itself, it is lifeless—it has no inherent ability to react to keyboard strokes, mouse movements, or gamepad sticks. To make it move or interact, we must connect it to a PlayerController.
Establishing the Connection
Possession is the process where a PlayerController takes control of a Pawn. Once possessed, the Pawn starts receiving input data routed through that controller.
When you create a custom Pawn class in C++, you define its physical properties—like a StaticMeshComponent to represent its shape or a SphereComponent for collisions. The "bridge" is established when the GameMode tells the PlayerController to spawn or assign a Pawn for the player to inhabit.
Here is how you might represent the start of this logic in a Pawn subclass:
// MyPawn.h
class AMyPawn : public APawn
{
// The visual representation of our pawn
UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* MeshComponent;
// This function is called by the engine when the Controller takes command
virtual void PossessedBy(AController* NewController) override;
};
When PossessedBy is triggered, the Pawn becomes the "active" entity for that specific player. Any input commands mapped to the controller are now translated into physical movement for this specific object. Without this possession link, your input commands are effectively "disconnected" from the 3D world. By defining this class, you ensure your game has a tangible entry point where the player’s intent meets the engine’s physics simulation.
Key Takeaway: A Pawn is a physical Actor that remains inert until a PlayerController possesses it, creating the vital link between player input and in-game agency.