Best way to posses posses multiple pawn at once?

Hello,

I am making a Cannon Fodder style game, where player will have a handful of units which are quite directly controlled (WASD + aim to mouse position) and will be able to switch between them. I want the switching to be a fluid process, so that camera smoothly pans from one unit to another. Therefore most obvious solution is to have one “Player Camera” style pawn, which is possessed by the player controller, and then control the individual units as well, but indirectly.

I broke my teeth on the fact one player controller can not send input to multiple pawns at once. I am using FloatingPawnMovement component to control the units. Even if I explicitly enable input on the units, and make very, very thoroughly sure that Block Input is not enabled on any actor in the scene, I still can’t get any other pawn than the Player Camera pawn to move.

I am thinking about some workarounds but they all are extremely overcomplicated. So I’d like to ask if anyone knows any straightforward, common solution to this problem.

Thank you in advance.

Alright, I’ve found a solution. Posting it here in case someone else ever needs it too :slight_smile:

First, in my case, pawn I want to control is already placed in scene, so I’ve created a reference in Level Blueprint, and passed it as variable to my primary possessed pawn:


Then, in this Pawn I’ve just created reference to, I have created two custom events as well as two variables for axis value, as even the pure axis value functions don’t appear to work when pawn isn’t possessed. I’ve used these to replace input events and their axis values:

And then, in my primary possessed pawn, I am simply forwarding the input to the pawn reference I’ve got passed on from Level Blueprint:
PlayerPawn.JPG
It’s not as clean as I’d like it to be, but it’s not really overcomplicated either, at least I hope :slight_smile:

cheers

Thanks, I’ll come back to this when I want to do the same kind of thing.
I suppose the devs at Epic feel that multiple pawns for one controller isn’t useful enough to warrant its inclusion in the engine. It would be nice to simply set the curent controller from a pawn, for as many pawns as you want.

hello, i found a solution…see if this is same as you wanted

Hi reading the given solution i thought at one that would be cleaner (maybe).
Creating the Soldier actor class which can move and shoot and just one Pawn called Army which represents the set of “Soldiers” and spreads the inputs through every Soldier which references are located in an array.
Give me feedback on why it would be ok or not, thanks !