Vehicle Tutorial

in the vehicle blueprint, where you set the wheels in the defaults properties

if you want to cheat you can just copy the content from the old beta and paste it into the 3rd person bp template project and then just swap the default pawn class

thanks, I found it but unfortunately I still cant figure out how to get the steering working, I tried plugging key input “A” into a “set steering input” node (I did put a value in just to see if it would turn) but it did nothing so i’m stumped for the moment.

I have just managed to get the steering working so I now have a car that drives forwards/backwards and turns left/right, its a bit dodgy though so I need to do a lot more teaking:p

You should write a small write up on How You Did that, to help others :slight_smile: (getting the car in and working)

while I agree a tutorial of some kind would be a good idea to get people started its not possible to do it as a small write up because I am not very good at explaining and I would need to explain all the nodes in all the blueprints witch means it would take me ages to write it and it would be massive, I cant really do a video tut either because it will need to be a couple of hours long.

I was thinking I could make a new version of the project and then release it as an example for people to play around with (it would take me a few days because I need to redo the model/textures…ect) but there are a few problems with that idea, 1: epic must have removed the sample for a reason (whether they just weren’t happy with it, because it was buggy or are changing how vehicles are done I don’t know (if they are changing the way vehicles are done then my example would be almost useless)), 2:you have to release a control before you press the next one because of how I had to set them up, 3:i am not sure how I would release it to you guys, I used to upload stuff to my mediafire account and then put a download link in the forum but I don’t know if I’d be allowed to do that or if I would have to put it on the marketplace or whatever.


just thought of another, 4:it would only work for car games (like racing games because you are the car), although ryanjon made a car you could get in and out of, if you merged what he did with what I did it might be usable for other gametypes like GTA or whatever.

I have been working at this endlessly and have made very little progress, although it appears to be far more difficult with a hovering vehicle. Either that or my sheer lack of knowledge of Unreal. I look forward to more updates to this thread.

Vehicle physics are identical in UDK, and there are many tutorials on that :wink: :cool:

From what I’ve figured out (with all of 3 days of unreal experience… so there may well be things I’m doing in a sub-optimal way) so far:

  • Create your vehicle and import the skinned skeletal mesh into Unreal. The requirements seem to be the same as those mentioned in UDK/UE3 tutorials and I used one of those as a guide for exporting my test vehicle. Before exporting, orient the car so z is up and x is forward and orient all the bones in the same way. Essential bones are the chassis bone and 4 wheel bones (which should have the chassis bone as their immediate parent).
  • Create an Animation Blueprint with AnimInstance as its parent and the target skeleton as your imported vehicles skeleton.
  • Create a Blueprint that has VehicleWheel as its parent. You appear to need to create your own wheel blueprint to be able to adjust the radius of the shape used to simulate the wheel (and the min/max suspension offsets). Make these adjustments to your wheel blueprint.
  • Create a Blueprint that has WheeledVehicle as its parent. Use the imported skeletal mesh and the animation blueprint you created in the Defaults tab. In the Components tab add wheel settings to the VehicleMovement component, use the wheel blueprint you made as the wheel class.
  • Edit the animation blueprint. Use the event graph to retrieve the Suspension offset, rotation angle and steering angle for each wheel from your Vehicle blueprint when the update animation event occurs. Store these in variables so that you have them available for use is the AnimGraph (I’m actually storing a single Transform variable for each wheel that combines all 3). In the AnimGraph start with the reference pose then use the Transform (Modify) Bone node to apply the aforementioned data to the relevant bones (make sure the translation mode is “BMM_Additive” for translation and rotation in the nodes details pane).
  • Create controller to drive vehicle with.**Haven’t gotten to this yet. For testing so far I have a construction script in the car blueprint which sets the throttle and the steering so the car just drives around in circles.

At this point my car model moves around and the model appears to correctly represent what is going on with the physics simulation (wheels roll, steering is correct and suspension movement appears OK).

I’ve tried to remember all the major points that I got stuck on, but there are sure to be things I haven’t mentioned waiting to trip you up. I’ve only given fairly broad directions as I’m still playing around with it myself. Hopefully I can look into controllers tomorrow, but there are so many cool things in the engine to play with. :stuck_out_tongue:

If this helps me get closer, you will be my new best friend.

EDIT: So I’m not exactly closer. The wheel setup was helpful but I haven’t managed to make any gameplay progress. Problem is, I spawn in as my vehicle but I’m just stuck floating at whatever point I start at. No falling, no movement whatsoever.

Have you got Physics Simulation enabled in the defaults for the cars blueprint? My car doesn’t drop to the ground under the effect of gravity if I uncheck that option.

I also didn’t mention in my last post that the Physics Asset generated when the car is imported probably needs editing. The collider the import generated for the chassis was a big sphere, I replaced it with a more appropriately sized box.

as mentioned before and after a chat with some people who know, i wouldn’t do to much on the vehicle side atm as the vehicle code base is likely to change in the near future, if you still want to push on with the current code then i’m willing to do a quick run through video show the required blueprints, when i say quick we’re still looking at at least 20 mins and even then i may miss a few bits.

this would be purely for wheeled vehicles and i would have to use one of my old content so it won’t be pretty and not perfect.
you’ll need to use the third person shooter blueprint template and you would spawn as the vehicle

I will try that next. I already edited the Physics asset because… **** that was way off. I did read later on that the vehicle class does not assume gravity is a factor.

As far as the rest of this goes, I’ll slowly try to make progress and update myself on the thread once in awhile until some vehicle related update is released. Plenty of people have managed to make a hovering vehicle using physics thrusters, but knowing my luck with those, I don’t know if I want to risk starting an entirely new blueprint setup just to screw it up. In the meantime, I’ll work on my backlog of numerous game ideas. There’s a zombie shooter I’ve had in mind for a while.

I would very much love this video if you could do this!! Maybe provide us with the assets in a .ZIP or .RAR so we can do exactly like you did on Video!

ok but it will take a day or to to set up

Update! I now have a vehicle that can drive forward and backward, albeit having very strange braking. Also, steering isn’t quite there yet. Of course, certain issues are bound to arise with invisible wheels, but I just cannot turn at all. All it does is jitter side to side when I attempt to turn. So if anyone needs pointers on doing a hover vehicle, its actually fairly simple so far. Just need to finish up tweaking, really.

ok the video is uploading right now, as mentioned the vehicle side of UE4 will change so i still advise not to invest to much time as it is likely your work will be useless after any base code updates.

if you have any questions about the video please post on my support thread

If you’re making your vehicle skelmesh in Blender, be aware the Blender FBX exporter will add a phantom bone into your skeleton named after your armature object. From my experiences in UDK, the engine seems to consider the Z positions between the root body and wheel bodies for physics stuff. This phantom bone makes this very very twitchy (And will make root motion animation impossible later if you do that!)

If you want to remove this “functionality” from the exporter, here’s how.

Find your file in your Blender install folder, mine was here: C:\Program Files\Blender Foundation\Blender\2.69\scripts\addons\io_scene_fbx

Open the file and locate line 2421, it should be fw(’
Connect: “OO”, “Model::%s”, “Model::%s”’ % (my_bone.fbxName, my_bone.fbxArm.fbxName))

Remove it, along with line 2420 and 2419, so you end up with the following:

2415    for my_bone in ob_bones:
2416        # Always parent to armature now
2417        if my_bone.parent:
2418            fw('
	Connect: "OO", "Model::%s", "Model::%s"' % (my_bone.fbxName, my_bone.parent.fbxName))
2420    # groups

Python uses spaces and indentation and blank lines, so make sure it looks like that. Don’t put the line numbers in there! I just put them in to show that spacing and such matters in Python otherwise the exporter won’t work.

Now when you export FBX from Blender, you won’t have that phantom unmovable bone ruining your day in UnrealEngine.?

Are there any tutorial about this?

Geodav put a quick run through video of UE4 vehicles on his youtube channel, although like geodav says I wouldn’t bother with vehicles until epic has finished with it, the way vehicles work is a bit sketchy.