Hi, here’s my problem. I have a third person character who have his own input controls setup. I have a car who has his own inputs setup and I’m trying to possess the car and of course, drive it (think GTA).
The strange problem is that when I possess the car, I can use some keyboard inputs to control the car but not all of them!
For exemple, the “walk forward” of my third person character is assigned to the up arrow of my keyboard. If I try to assign this key to the throttle input of my car, my car is not moving, but if I assign another key like “W”, it works! Of course I’m talking about the input settings in the “project settings” window. The throttle input of my is actualy assignet to both “Z” and “UP” of my keyboard but my car move only with the “Z” key, “UP” is not doing anything.
Another thing to mention, if I use a gamemode with the car as “default pawn”, I can move the car with the “UP” key without touching anything !? Of course I need to have my 3P character as the default pawn and I need to use the less key I can
What is likely happening is that the character is consuming the input so that it nothing else is able to detect it. In your character, you should be able to uncheck the “Consumes Input” checkbox for your input event so that it doesn’t prevent your car from receiving the input as well.
Wow, shame on me, that was so simple, thanks. But when I possess my character again (exiting car) I can’t control it. Is there a specific node for this? I tried the “spawn default controller” right before or after the “possess” node but it doesn’t work
Can you provide a copy of your project so that I can test the behavior you’re seeing directly? If you’re able to upload the project to google drive or dropbox, you can post the download link here or send me a PM on the forums with the download link for privacy.
I can’t, my project is something like 10Go. But basically, it looks like everything in controller blueprint is ignored when I possess the new spawned character (Maybe I should not destroy it when I possess the car, only hide and unhide it + move to new location when I exit the car and possess the character again?).
My game is multiplayer and run on a dedicated server.
I can control the character before possessing the car, I can possess the car and control it since I’ve uncheck the “consume input” like you said, I can possess the newly spawed character but controls (which are in controller blueprint) doesn’t work anymore after exiting the car)
As you suggested, hiding/disabling the character when you enter the car and then unhiding it when you exit could provide better performance for your project than attempting to destroy and respawn the character, depending on how long the character is inactive/hidden and how much it does while hidden.
Something else you can test would be to have the character print the controller they are using at spawn. If you’re able to control the character before getting into the car but are unable to after exiting, it sounds like the appropriate player controller is not being assigned when the character respawns. This can also be solved with the hide/unhide method as the character should not lose his controller.
I am having a very similar issue in UE5.1 When I have both 3rd person character and vehicle (the template-based ones) I can only control the auto possessed one but when I try to possess the other one through blueprints It doesn’t respond to inputs and doesnt move. So if for example I start with playing with the 3rd person character and press the keyboard shortcut that I designated to possess the vehicle it gets possessed but doesn’t move and Vise versa. P.s it worked correctly as intended in UE5 but not 5.1 for some reason, I don’t know what changes they did. Anyone experienced such an issue?
5.1 uses enhanced input. You have to convert over to it.
Put all your control/input logic for the vehicle in the vehicle class.
Put all your control/input logic for the character in the character class.
Put menu/settings and other universal input logic in the controller.
Do not reuse inputs.
There should be a dedicated enhanced input forward for character and a different one for the vehicle.
Player movement: Forward, Backward, strafe r, strafe l etc…
Vehicle movement: Accelerate, Reverse, Brake, turn etc.
Thanks for the fast reply. I will check the resource you supplied, really appreciated.
I am kinda new to unreal just a few questions, so I understand more:
You say I have to “You have to convert over to it” I am on 5.1 by default not upgrading from 5.0 do I still have to convert to it and how?
When you say “Put all your control/input logic for the character in the character class” Do you mean take movement nodes out of the BP_ThirdPersonCharacter blueprint and put it another file and which is that (do you have a filename for it?
You said “There should be a dedicated enhanced input forward for character and a different one for the vehicle” should I create a new profile of some sorts in the project setting - > Enhanced input page
And if above is correct, do you mean I should use WASD for vehicle and maybe Up D L R Keys for the player?
What’s the difference between the two “You can reuse KEYS, just not input actions.”
Looking forward to your reply. I am sure many newbies like me will benefit from explanation as it will also help shed the light on how things work.
As of UE 5.1 input mappings (project settings → Engine → Input) is being deprecated. Enhanced Input is taking its place. Old inputs still works to a degree, but might not by 5.2.
You need to convert to the new system.
Traditionally, you’d put all input nodes and logic (movement/actions etc) in the controller class. Since you are un-possessing/possessing different PAWN classes (character/Vehicle) it’s best to keep logic in the owning class vs bloating the controller.
e.g. All movement/event/action logic for the character would be coded in the BP_ThirdPersonCharacter class. All vehicle controls would be coded in the Vehicle class.
Input Mapping/Action re-usage…
Let’s say you have an Input axis mapping for Forward and Backward character movement. Instead of re-using the same mapping for vehicle accelerate and reverse, you’d create a new mapping/action for those.
What keys you apply to these mappings doesn’t matter. You an re-use keys.
Forward: W, Accelerate: W … What matters is you have to have different input mappings/actions for each.
Eventually you are going to want to have a settings section in your game to allow for custom keybinding. If you re-use the input mappings then you will not be able to have separate keybinds for character vs vehicle movement.
For example say I want to use WASD for character movement and I want to use the arrow keys for vehicle movement. Re-usage of input mappings would force the usage of WASD or arrows on both. They couldn’t be keyed differently.