How to use a player controller to control a pawn?
Currently I am using default player controllers. I posses every controller to a pawn, it's working. The problem is that the first controller is always controlling keyboard and gamepad. I want to change that by creating my own controller class that inherits from PlayerController.
But how does that binding between Pawn and PlayerController works in detail? Like what happens in detail if a keyboard key was pressed? And why is only the pawn with Controller0 is getting keyboard input? I assumed that the controller had a reference to the possessed pawn, but in the blueprints I cannot find anything like "GetPossessedPawn" or something...
For a possible solution I was thinking about following idea (see image). The controller (must be the first controller) is getting Keyboard/Gamepad0 input. If the input is from the keyboard, the command gets delegated to the "keyboard" pawn. If its not from the keyboard, the possessed pawn is getting that command. This idea has some problems:
Any idea for a solution without the 3 problems?
Player 1 will always be set to Controller0. Other players that join locally will be set to Controller1, Controller2, etc. As far as getting the pawn that will be controlled, you can use "Get Controlled Pawn" and send inputs to that actor.
answered Jan 16 '16 at 11:33 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here