A Pawn is an Entity any Client (player) can possess, this is the physical representation of your player within the world. This entity doesn't need to be anything specific, you can make it a physics object or a traditional animated player.
When a Client possesses a Pawn additional methods become active on the Entity:
- Entity.Simulate( Client ) - Called each tick serverside and clientside, this is predicted.
- Entity.FrameSimulate( Client ) - Called each frame on the client only to simulate things that need to be updated every frame.
- Entity.BuildInput( InputBuilder ) - Called every frame on the client to process input for your pawn.
- Entity.PostCameraSetup( ref CameraSetup )
There are several examples on how to use pawns in various ways:
- sbox-minimal - a basic standard player pawn
- sbox-netlab - a more complex pawn controlling it's own animations and movement
You can set the Client's Pawn at any point, a standard place to set it would be when the client first joins.
A good way to get all pawns in the game is to iterate through all clients and access their pawns:
Any time you want to access your pawn clientside you can do so through Local.Pawn: