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.
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.
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 this!
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!
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!
Awesome Jacky, I have been meaning to add in some functionality to allow a pawn to enter a vehicle for a while now, will give this a try when I have some free time. Thanks for the demo & tutorial!
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 this Jacky 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
Heh…i wouldnt have bothered with this if i knew about that documentation. But i’m glad people are finding this useful and now they can see that link to the documentation as well. Using the vehicle class doesnt work only because of the Box component. You cant generate events without a box component in this 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.
This is pure class Jacky
Haven’t been on the forums in a while, due to work pressures - but was greeted by this GEM when I logged in…
It’s funny actually, all the time I’ve been on these and the Epic Games forums, it never occurred to me that you might be the same “Jacky” 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
I’m not that Jacky, unfortunately. I’m not even a huge fan of the GTA series, but there was a need for this kind of stuff by the community so i gave it a go.
I have been implementing enter-able vehicles and encountered this problem as well. I had been searching for a solution and someone linked me this topic.
So far I’ve been unable to actually solve the problem. Jacky, 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.