Control 2 characters simultaneously with the same input

Hi,

I would like to control 2 characters at the same time using one input. There’s this tutorial which teaches how to control 2 characters with 1 part of the controller, which is not the case… How do I do it?

Thanks!

Nobody knows?

I haven’t tried this but try to spawn 2 characters, and on actor settings search for “Input”, and set “Auto Receive Input” to “Player 0”. Even if this work, it will probably work for single player only.

Yeah, I’ve tried it. Even if I put the 2 players as player 0, it only controls 1 player. I am having problems with raycast (in third person, the raycast jitter when the character rotates because the camera takes the character rotation input, so to prevent that I thought I should control 2 players simultaneously, 1 invisible that doesnt rotate and 1 visible that rotates, and the raycast would start from the non-rotatin-invisible player, therefore not jittering) and this is the only viable solution that nobody knows or care enough to answer (except you) =/

One workaround is to store input values as variables every frame then create an AI controller for the second pawn that looks at the variables saved every frame and ‘controls’ the second pawn using those inputs. A little convoluted and not the most performant solution, but it’ll work.

EDIT: another solution to come to mind is to handle all input on the player controller rather than the pawn (if you aren’t doing this already) and create an array of pawns you’d like to control. Then on input events, send control events to both pawns at once. Example:

Current solution-
Get input on Pawn > Execute input on pawn
OR
Get input on Player controller > Execute input on pawn

New solution-
Get pawns you want to control, put into array > Get input on Player Controller > For each pawn in this array, execute input on pawn

Depends on what you want to do with your two Characters maybe.
I am using two characters, one is the players’ ‘Avatar’ in the game and one is the Character that the Avatar plays. In my game the Avatar does not really affect gameplay much that is up to the other character that it ‘controls’. Even so I have chosen to have the Avatar being the main character that is ‘Posessed’ bu the players. And then I control the other one by messaging, ie triggering stuff remotely and sending variables via a Reference on the Avatar.

I am also doing a network setup and this have meant that it gets very complicated. So I would warn about that.

One of the main concepts to understand is that you can only ‘Possess’ one Pawn. And that affects a lot of things.

Start with a simple test to understand how it works and then expand.

Cheers,

^This.
You should handle (if possible) your input in the Player Controller anyway, not in the Pawn itself.

Will try it, thank you guys for taking the time to help me. Appreciate ya!

I tried 2 hours by your advises, finally almost resolved.

  1. On Input Event, set the input value to GLOBAL variable, use Game Instance. (You can search other topics for game instance and global variable.)
  2. Get the input from game instance variables, give it to “Add movement input”

After this, I’m still failed.
But when I copied the character BP file to another, (2 players, 2 different BP file), it worked.