Local Multiplayer mobile movement
I'm trying to develop a 1 to 4 local multiplayer game for android, and when it comes to movement I have some questions:
I've been looking into UMG and into touch interface and what I would like is to have 1 joystick per player that will allow them to move. But I'm not sure if this is possible because:
What is the right way to approach this?
asked Apr 25 '17 at 07:36 AM in Blueprint Scripting
Sorry for the late late reply. I didn't have a pc when I read the question and then I spent days looking for the project that I did but I can't find it. Luckily I do remember how I did it :).
First create your own player controller and your own Pawn.
Then on the project settings define input settings. (This is a bit of a hack but it does the trick.)
Define 2 axis inputs, so P1MoveForward, P1MoveRight, P2MoveForward P2MoveRight. Now this is where the hack comes, You need to bind this defines into different types of axis. So for example make P1MoveForward and P1MoveRight match Gamepad Joystic X, and P2MoveForward and P2MoveRight match Gamepad Joystic Y.
The idea is that with a controller you would move Player 1 with the left joystick and Player 2 with the right joystick.
Now you need to create a UI that includes 4 touch joysticks and bind them to the different inputs, I don't remember this exactly but that should be easy as the example already comes with the touch input bind to something?.
Finally you need to make 1 player only care about one inputs and another player only care about other inputs. There are multiple ways of doing this.
You can have 2 controllers (of different types) , and each player has each controller . And have different SetutInput functions on them.
Or you could have two different types of pawns with different SetupInput function.
You could even have only 1 controller that has possessed player 1 and has a reference to player 2 and whenever player2 Input gets trigger just does pawn2->MoveForward() for example.
However you wanna do it is up to you, but I think the trick was into binding different inputs to different tools that unreal provides such as different joysticks from different gamepads.
answered Aug 08 '18 at 10:04 AM
my guess is that maybe touch inputs all always go to player controller 0, so you might need player 0 to relay that and call its respective functions with parameters on player 1's controller
answered Aug 06 '18 at 12:06 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here