How to put character into a vehicle?

Hello I was hoping to get some guidance, I made a car and my character but how do I go about putting him into the car? I’m making game in 3rd person and want to have my character grab a door handle, open door get in and be shown driving. Does anyone know of a tutorial to do what I am looking for I haven’t been able to find anything. Thank you for your time and assistance.

How are you planning to achieve this? Blueprint or C++?

Whichever way you go about doing it, you’ll need to animate all the moving parts in your sequence - that’s the character, the car door, and maybe the handle, if you want that LOD.

The easiest way to make it work, is to have your character move to a specified position in relation to the car when the ‘enter car’ event is triggered. Think GTA - no matter where you were relative to the car, your character would walk round to a specific point every time. This makes it much easier to handle the animation side of things, because you’re using the same animation without needing to do any procedural blending etc.

Thanks for your responses, I am hoping to keep everything in blueprint. Yes a GTA style system would work perfectly. Any idea of how I would set this up with BP? I can do the animations no, it’s just knowing what to plug into where that I am still trying to learn.

Well, you can put a helper socket on your vehicle, which your blueprint takes the location of to move your character into position. This isn’t perfect, since if the vehicle is on a tilt, your character may move into the air. However you can probably find a way around this (such as ignoring the Z-height).

You could place a volume around your vehicle, that if the character is inside of, and hits the appropriate input, initiates the enter procedure. Then its a case of telling your character to move to the position defined by the helper object. After that, you call the animation montage which has your ‘enter’ vehicle animation, on both the character and the vehicle. Then its a case of taking control of the vehicle pawn.

Not 100% on the BP, and not really in a position to play around with it right now - but there should be plenty to get you started. I’d personally start with just getting the character to take control of the vehicle, and worry about the animation side of things later.

1 Like

Thank you for your help I can’t wait to give your suggestions a go.

Since you are using Blueprints, i have moved this thread to Blueprints section so you might get more response. :slight_smile:

At it’s most basic you want some trigger for entering the car (possibly a shape like a box) which will disable character movement on the character, attach it to the vehicle (assuming you can still see your character when they are driving) and then tell the PlayerController to posses the vehicle instead of the character.

can you tell me how to change PlayerController to other things? thanks!

You want to get a reference to the Controller, then call the Possess function on it, passing it the pawn you want to possess.

Axtel Sturnaw , could you post a picture of a example blueprint of giving player controller to another object? Thank you for your assistance.

Here is a basic example of how it might be done. Note this is just a pseudo graph but you will be able to improve it from this. :slight_smile:


Thank you Ryanjon2040

Also, you will want to store your player pawn in your gamestate BP, so that you have a reference to the pawn you need to possess when you get out of the vehicle.

Thanks Axtel , you probably just saved me a future question. Appreciate all the help everyone.

I know this is old but im still searching for stuff that I cannot find on google…but i was curious as to why you would put a ComponentBeginOverlap on the character and not the vehicle?. Otherwise the CanEnterVehicle variable will be on all the time…You only want it on when the character walks up to a vehicle