[noob] PlayerController and Pawn = i don't understand anything...

Hi everybody,

I read in the docs that the correct way to control player character is:

  • create a Pawn class for player object behavior

  • create a PlayerController class to stand keyboard input and control the Pawn

Now the question is: how access the Pawn reference in the PlayerController script ?

I read i’m supposed tu use the “Possess” méthod…

…but i read too it only works on server ??? wtf ???

Well you kinda got it right.

If you need a player (or pawn) depends on the type of game - for a “guess my number” game it would not be necessary. :slight_smile:

Instead of a pawn i recommend creating a “Character” - that is a sub-type of “pawn”, but it comes with a big bonus: It already has built-in support for “walking”, “Swimming” and so on.

In your project settings you define the standards. The “Boss” of your standards is the “Gamemode”. If you want to create your own PlayerController from scratch i also recommend to create your own “GameMode”. The Game Mode defines loads of things. One of them is the “DefaultPawn”. You should set the DefaultPawn to your character blueprint, then when the game starts it will load your custom GameMode and see that your charatcre is the default pawn, then it will automatically use (posess) this one for the end user to control.

Pawns can also die in-game yet players still respawn hence need for controller.

But this is one of those things that’s often a lot more confusing written down.
But if you slowly go through one of the many free FPS kits on here, it will help.

Dissect one, take it apart and it’ll be clearer what the steps are and why.
Alternatively look at the Epic Twitch video on split-screen multiplayer etc…

Fronzelneekburm > You’re right, my GameMode blueprint is empty, i could have put keyboard inputs inside.

But i cannot remove the PlayerController, it is required by “set view target with blend” (i wonder why this is required to select the camera…)

franktech > i looked at the FPS official template, seems they don’t need PlayController

the only template using PlayerController & Pawn is the point and clic…

Well they don’t use custom player controllers, but they do use custom player characters. Typically, in the example projects, the inputs to move your character are defined in the player character blueprint.

When you’re starting out, I might suggest open an example project like the FPS one and try to tinker with it to make it do additional things. For example, try adding a sprint key or implement double jumping rather then trying to start from scratch right off the bat.