GTA Style Vehicle Interaction - Project File Included

Hello there,

Here you’ll find a sample project that lets you drive any number of vehicles that exist in a level, as long as they are based on the same vehicle BP. It is setup in Player Controller BP and making it work with several different vehicle BP’s is up to you. And dont forget to add a box(or sphere, doesnt matter) component to your vehicle BP for overlap events as you’ll see in Sedan BP’s in the project.


UPDATE: Thanks to Omar007 the project is now MP ready and it is easier to implement for just single player too. You can download the project from one of the links below.

Download 1

Download 2

4.8.1 Update

Enjoy!

Hi ,

Great tutorial and setup here!

I gave it a shot and everything worked pretty well.

Couple of things to note though.

I flipped one car upside down by hitting it with another car. By being able to still enter the car and exit the camera now flips sideways. So possibly having a check to not allow entry to cars that are flipped upside down would be good. :wink:

Also, another thing is there the vehicle does not slow down and stop after jumping out. It will keep it’s same trajectory and movement speed. Notice the orange car. It was continually circling me like shark while I typed ! :slight_smile:

Great start for anyone here though to lead off and have some fun! I would love to see more vehicle games from the community! I remember when I bought my PS1 the first game I bought was Twisted Metal and Driver!

Thanks for trying it out, !

Yeah, i didnt even think of those issues you found out because i was more focused on handling the possession of multiple cars in the same level. It has been asked a couple of times before and even though i helped some folks out nobody bothered to turn them into a tutorial(even though i asked so nicely!) so i decided to do it myself. -_- I can add those features later on, and if anyone happens to add them before i do feel free to post here please!

Making and breaking games is fun and hard and I certainly enjoy both. While I do enjoy breaking them they are never perfect on the first release. Great work on the tutorial. It really is a great starting point for anyone looking to do vehicle games with their characters!

Thank you for taking the time and giving back to the community. It is always appreciated! :slight_smile:

Hi !

System looks cool :slight_smile: Had a look at your Blueprints from the video and have some remarks :slight_smile:

You really want to stay away from using the “OR”-node when checking if you’re in a Sedan or controlling player.

While you only have one vehicle type (I assume any vehicle is considered “sedan” right now?) I’d recommend using the following instead:

saves you the trouble whenever you add a new class, you don’t need to update portion of the BP!

Awesome , I have been meaning to add in some functionality to allow a pawn to enter a vehicle for a while now, will give a try when I have some free time. Thanks for the demo & tutorial! :slight_smile:

Brilliant! Thanks a lot, Tom. :slight_smile:

I’ve updated the screenshots and the project file.

Is it possible to do with different vehicles in the game such as a sedan and a van?

It is possible. It will be a bit complicated if the van is not a child BP of the sedan so i would just create another child of the sedan and then replace its mesh and defaults with the van’s. That way it will be a drop & use vehicle with the rest of the vehicles you have.

thanks for something i’ve been wanting to try for a long time, was thinking though if you made it so that it worked from “child of vehicle(code file)” might that be better, but then i haven’t a clue if it would work

btw looks like they updated the docs which should help
.unrealengine.com/latest/INT/Gameplay/HowTo/PossessPawns/Blueprints/index.html
about halfway down

Thanks for great tutorial.

In Step 15 of the Entering/Exiting a Vehicle tutorial, how do I get the blue Set Car mode? Which BP should I be working on - Sedan or MyCharacter?

Heh…i wouldnt have bothered with if i knew about that documentation. But i’m glad people are finding useful and now they can see that link to the documentation as well. :slight_smile: Using the vehicle class doesnt work only because of the Box component. You cant generate events without a box component in current setup, so… But it is doable if you find out whether you are near the car or not with traces or some other way from FPS character side.

@Sunboy: Happy to help!

@jeffmorris: I havent read through that tutorial yet so i cant help you on that right now.

I printed out the tutorial and went through the tutorial again and it worked. I added two more cars and I can enter/exit any car.

is pure class :wink:
Haven’t been on the in a while, due to work pressures :smiley: - but was greeted by GEM when I logged in…
It’s funny actually, all the time I’ve been on these and the Epic Games , it never occurred to me that you might be the same “” from YouTube who used to be a GTA modder???
I only ask because we used to have a bit of banter in my UDK tutorials and what not …
If you are, it’s a small world ;), if not, you rock anyway :smiley: :cool:

Hey Dave!

I’m not that , unfortunately. :stuck_out_tongue: I’m not even a huge fan of the GTA series, but there was a need for kind of stuff by the community so i gave it a go. :slight_smile:

Hope to see you around more often!

Hi. I get your tut. with working for mine character but like said cars dont stop. Maybe we need to respawn car when exit?

thank you :slight_smile:

I have been implementing enter-able vehicles and encountered problem as well. I had been searching for a solution and someone linked me topic.

So far I’ve been unable to actually solve the problem. , did you have any luck getting it to properly stop?
I’ve tried resetting input, setting velocity to 0, applying negative velocity, stop movement immediately, even calling VehicleMovementComponent’s ClearInput() function in C++ but it just keeps going D:
It’s as if Unposses is not properly resetting movement/input for vehicles.

Also, I noticed that vehicles do not handle/determine collision in the same way as other objects; I had an object without any collision but the vehicle can drive over it. The chassis would clip through like everything else though. Only the wheels collide.

Using UE version 4.5.1

Add to the end of Leave the car and spawn player section:

f5e1a26a7aa1500171885836ff78ebb4cebad1cf.jpeg

Now the car will pull the handbrake when you leave it and you’ll have to tap the handbrake when you re-enter.