Download

Possessing Multiple Vehicle types

I know How to Do pawn possession and right now I have a single Air Transport Vehicle I can jump in and out of.
But moving forwards I also want to have multiple types of vehicles, ACP’S, Tanks, gunships, Jeeps, Mechs, ect.

My set up is a vehicle with a collision box around it that detects overlaps with my player character, if hes overlapping an internal bool is set to true EG: can enter.
The issue I ran in to is My character controller is getting all actors of class and and looking for the can enter bool and possessing it, if can enter was true.
But as I want many types of vehicles I am confused as to how to call all types and not just the single vehicle class. So I created an empty Pawn with some common variables and re-parented that vehicle to it and was planning to use that for all types so they can inherit the basic possess logic ( the possession bit worked fine But as my Vehicles are using physics they weren’t working correctly.
Has anyone got any good tips or advice on best practice to possess multiple vehicles types

I came up with what I think Is a better method where I do a line trace from the characters face and Its only looking for a hit actor with the TAG of vehicle, but I have run in to a problem because The hit actor is not compatible with the possess node :frowning:
how would I solve this, I can’t find a method to get a hit pawn result from a line trace :frowning:

I’d suggest maybe a blueprint interface which each vehicle can then have attributed to it, or just a general interaction system which would go through the blueprint.

Example of how it works-
On player pressing ‘E’ you do a line trace, check to see if the actor has a blueprint interface for vehicle, if so it will run a “EnterVehicle” function which is defined in the interface. Then in each vehicle blueprint you have a function (like an override) that is also called EnterVehicle and you put the code in there.

To have it really tidy and with little duplication each vehicle would come from a generic vehicle parent blueprint which would handle the bits which would be repeated across each actor.

Thanks That’s a great Idea. I will certainly try this approach.
As for the generic BP for the common variables I have already tried this But for some reason the controls are not behaving correctly :frowning:
Trying to troubleshoot it