Multiple playercontrollers using keyboard
Hi, I'm working on a 2 player(local) game.
My second player is created using GEngine->GameViewport->CreatePlayer(1, ....); in a custom GameMode. The second player spawns correctly, but I cannot control it.
I have a PlayerController in blueprint that handles keyboard input to move the pawn created by the player. Both players created use the same type of PlayerController, but the keyboard events fire only on the first player.
I have tried changing to CreatePlayer(0, ....). All my characters and controllers have Auto Receive Input disabled, although I have tried all possible values for them.
I have spent hours searching and trying to figure out how to control both players with the keyboard. I want to use WASD for one player and the arrow keys for the second.
Any help would be greatly appreciated, thank you!
asked Apr 26 '14 at 03:16 AM in Using UE4
The keyboard input is by default allocated to go only to player 0. To change this you would need to subclass UGameViewportClient and override the behavior of InputKey
I'll make a note to consider whether to add some easier way of redirecting a given device (in the case of gamepads) or to allow sharing of the input device for the keyboard like in this case.
answered Apr 26 '14 at 11:01 AM
Marc Audy STAFF
I am currently working on a Fighting Game and I have local players using one keyboard quite easily.
Here is how I do it;
Create Player Character in Game Mode with new controller. Then in first player controller, I cast to the second controller to make things happen for second character. So it looks like 2 people using 1 keyboard, while internally both players are using the first player controller.
But yeah, a new system for local players should be implemented.
answered May 24 '15 at 03:39 AM
This really should be changeable in the editor. Please add my vote for fixing this bug.
answered May 22 '15 at 06:40 PM
Add my vote to this, it would be an extremely useful feature, I understand there are work around but it would make sense to have a more proficient method for this.
answered Dec 18 '15 at 09:09 PM
The Cheese Dragon
Please Achillon! Send screenshots of your solution for two players.
answered Nov 23 '15 at 07:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here