I have purchased a marketplace asset vehicle that is all set up with its inputs, it has its own game mode, but it is just the vehicle with no player model.
I have followed various youtube tutorials to get the ThirdPcharacter to interact and posess the vehicle. I have added all of the input controls in the project settings, but the character and vehicle share the same inputs and if the default game mode is ‘none or thirdperson’ the vehicle will not move once I possess it, If I use the Vehicles Game BP the vehicle will work but the ThirdPersonCharacter will not.
I am new to UnrealEngine and Blueprints, In my theoretical knowlege, I’d expect that once the Vehicle is posessed to use a function like ’ set to vehicle pawn class or game mode/state etc’
The only potential solution I have found is a tutorial that explains how to set ‘Is Vehicle Valid’ function and if not uses player controls so they are sharing the same keymap, but it has to be applied to all inputs for the character and the vehicle. (The UE Sedan asset vehicle automatically uses the same controls as the player)
If I had 50 vehicles that all used unique controls, I would have to expand every keymap. This solution seems very time consuming and inefficent (again I imagine the engine perpetually checking where you are when you press a key)
I would suggest maybe using your Vehicles Game BP as your Game Mode, but change the default controller and pawn on that GameMode to be your TPC controller and Third Person Character respectively. So that way you’ll start out as TPC with your TPC controller.
Unfortunately with the Marketplace asset and all, that’s going to be set up the way they wanted it set up. If the above did not work, you will need to do some rewiring, for instance if there is code hard set to override default controller/pawn.
Changing the Gamemode options still results in the vehicle not moving due to the shared inputs.
I only buy assets to understand how they were setup, with the intention of creating my own version for my game. I just want to know what is the most efficent (both for time and engine processes)
This is an example of how the player inputs are shared, if I add multiple vehicles I will have to add 'is car valid, is plane valid, is tank valid etc, as I say im not sure if it’s engine/code efficent or the typical way videogames swap action mappings between actions. ( I expect they use run_player/vehicle/horse class)
Since the solution isn’t obvious I will use this method for now and continue learning about Blueprints.
One thing you could do is use an Enumerator to determine player state! You could set the options to Pedestrian, car, tank, plane, or whatever, and when you possess something switch that Enum value.
Then, use a SwitchOnEnum node (selecting your created Enum as the base) and it’ll give you all the outputs you’ll need. The reason we use Enums for this purpose is an enum can only be set to the things in its list, and only one of these things at a time.
I think the reason I cant find a standard answer is that my question is stupid.
Google Searching for ‘unreal engine swap player contols’ results in many topics not related to my goal, but in every game the player swaps controls when going from a main menu > Gameplay > Pause/Options menu.
I know that ultimately there is a conflict between the UE_ThirdPersonBP setup and the Asset_VehicleBP setup.
I will start at the beginning and create a vehicle from scratch by following various tutorials, I’m sure at some point the answer will become obvious to me and I will be able to modify the asset.
Thanks for your assistance
My project has vehicles players can enter/exit as well. We decided against putting all the controls for both in the controller class itself. Each has their inputs/control coded directly into the Character/Vehicle respectively. This negates all the flow logic/duplication bloat.
Anything that’s universal (main menu, pause etc ) gets coded in the controller.
You can use your characters default game mode. The GM has no baring on the vehicle working or not. What matters is all the control logic for the vehicle is coded in the vehicle class and not the control. Just port what’s in the veh controller to the vehicle class.
Project Settings → Inputs
Don’t reuse inputs when you can. Create new ones, you’ll eventually want them when setting up player configs (key bindings).
e.g. Accelerate, Reverse, Steer Right, Steer Left, Brake, Hand Brake, Horn, Lights etc etc etc.
I’ve finally figured out the solution by comparing to the sedan and how that is set up.
In the asset I bought its Vehicle_Blueprint had all the ‘Event Nodes’ and in a seperate Blueprint it had all the ‘InputActions’.
So with my GameMode set to ‘none’ (or Thirdperson in the project settings) it was only running the vehicle ‘events’ and ignoring the InputActions which is why the vehicle wouldnt move (In my original confusion I belived that you couldnt share inputs without some sort of class/switching/mode system), So the solution was just just copy the InputAction Nodes and paste them into the actual Vehicle_Blueprint with the EventNodes above.
and now it works as it should, Ive added an interact function so my ThirdPChar can possess the vehicle and drive it as designed.
Why the Inputs were seperated in its own Blueprint? Don’t know! … Dont really want to think about that right now, it is related to gamemodes and/or network replication. (I will cross that bridge when I get to it)
So yea I asked a dumb question to start with , now I can start working on interaction animations. Thanks again for the help
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?