I’ve read up on all the “Control multiple pawn” questions on this forum, but I can’t seem to get any to work. I’m wondering if someone can help me.
My default Pawn for my gamemode is my VR Pawn blueprint. This takes care of movement and tracking for HMD and controllers.
What I want to do, is basically assign a pawn to each VR player (Remote control car for example), and let them control the pawn with the VR controller joystick.
Anyone have a strategy for a simple way to do this? Thanks
Hey there @ExistenceFUTILE! It depends how you want the car controlled. Are you attempting to just tie them to the touch controller’s joystick? Technically you can just pass the inputs to whatever you want, and then disable it when they let go of the controlling device.
So you need one player to control multiple pawns?
If you mean like simultaneously, in UE every pawn can only have a single controller, but you can easily read player’s input in any actor by setting AutoReceiveInput
(//EDIT or by changing it in runtime as SupportiveEntity posted above It’s the same setting, the difference is if its enabled automatically or on demand)
If you mean single player to change controlled pawn but always one at the same time use Possess and Un possess functions
@SupportiveEntity@lordlolek thanks for getting back to me guys, both of your suggestions seem to be the same, to enable input on the second actor I want to control.
I’m seeing this error when I try to do this “EnableInput can only be specified on a Pawn for its Controller”.
My original example was a car, but to test this out I copied in the BP_ThirdPersonCharacter from the sample app. So my default pawn class is my VR player, in my gamemode blueprint I spawn a BP_ThirdPersonCharacter for each player that joins the game and try to enable input. That’s when I get the error.
Edit: To answer the questions about how this is supposed to work, yes I want to control both simultaneously. Imagine everyone loading into a VR game and their avatars are controlled by the motion of the HMD and controllers, but then they can pick up a controller in the game and control an RC car or a little person with it (Like Moss if you’ve ever played it).
Is the actor you’re using a pawn? As pawns are the only type of object that can take input. If your car isn’t a pawn, then you may want to reparent it’s BP class under pawn. Will save you an immense amount of work handling the movement completely.
Hi, Pawn1 is the VR Pawn from the VR sample, Pawn 2 is the third person controller from the third person sample
Both are pawns. I’ve been playing with this for 24 hours and still haven’t gotten anywhere. I’ve tried all the solutions I’ve found on the forums, most are from many years ago and don’t know if they’re still relavent.
No worries it’s been a while since I’d used this method and I see it’s not reacting as I expected either, so I’m working up a couple tests. The last time I used Enable input like this was back in 4.23 way back in the day. Basically this ancient example is apparently a bit different now.
It seems like becauase it’s a Pawn it’s a little more strict on where the input comes from.
To make this extremely simple for myself, I’ve added the 2nd pawn as a child actor on the first pawn. So I have only one controller, and when I’m trying to forward movement input to the child actor Pawn it doesn’t respond.
It seems that enable input had changed a bit in that timeframe, possession is still viable but I see where that could be less than preferable if you want full control over your VR body as well. The less fun way to pull it off would be to just send events via event dispatchers to the car to execute the commands.
That is what you asked, but by the example, it doesn’t sound like what you want. In Moss, or (most?) other games with mechanics like that, you are only controlling one thing at a time. You already have everything you need if you approach it like that – Unpossess and possess, and then when you’re done, unpossess and possess the original one again.
Otherwise, you’ll need to build a way to do it, such as “have the regular pawn forward relevant input as commands to the vehicle pawn”. Which wouldn’t be terribly difficult to do, but it’s a lot easier if you just do it with possession, and it’ll be a ton easier to test and operate.
Ive answered your question with a video but im waiting for a moderator to approve it, it is possible, but you need to use the game mode blue and cast the variables to it and retrive them from the secondary pawn.
Dude you’re a rockstar, really appreciate you taking the time to work through this. Got a like and subscribe from me.
Unfortunately, I’m working on a multiplayer game so your solution doesn’t quite work, because I can’t access the gamemode from the client.
Turns out the VR Pawn doesn’t really use any pawn functionality, so I ended up adding all the VR Pawn components/meshes to my secondary pawns and all seems to be working well now.