UE3:Vehicle Tutorial (UDK)

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 19:12, 16 January 2010 by Dance (talk | contribs)

Vehicle Tutorial

This is a step-by-step tutorial on how to model, rig, export and script a custom four wheeled vehicle. Also this work is a combination of several tutorials on the subject so we by no means take credit for everything but only want to help others.


Part 1: Design

We have not explored all the different design types that can be done in UDK but it seems it is broad depending on the game you are making. Of course don't expect a low riding vehicle to cross terrain that will make it bottom out. But if your roads are flat then a low riding vehicle should be fine. The vehicle in this tutorial is pretty low but only have tested it in a empty room with a flat surface and works fine. Also lowering the wheel bones to there lowest point helps when you need suspension.


Part 2: Rough Model and Basic Vehicle Setup

I started with a box type car very basic model with basic tires and basic suspension. I did this in case i had to make changes or what not would not be difficult to start form scratch.


Naming

Get with your programmer and decide what names you all are going to use for bones to save all of you time in the long run. Your programmer will have to add the bones names in the script and the map editor will have to add the names to connect the bones to the controllers and the mesh in the editor. Naming your mesh when modeling will not be important because you will be merging it into one mesh when you are done modeling it.


Modeling

When you make your model just create your separate objects like normal body, tires, suspension. Then after you are satisfied with your model you will need to merge the objects into one. I know it doesn't seem logical that you are going to be using one mesh and that your tires are going to be able to rotate versus making your animated objects separate. Also I would suggest you saving your model as different file name before merging in case you need to go back and make changes.


Scaling

You will want to scale your model to the scale of a ingame character. You can always make adjustments to the scale later but i would advice against it unless you are a advanced user in your 3d program. All 3d apps are different so try exporting a static mesh and adjust it to a ingame character. Don't adjust it ingame just compare it to the ingame environment then adjust the units/meters/inches in your 3d app so you know what measurements you are going to need to make it look right ingame.


Aligning

You will want your mesh to align so your vehicles length extends into the X axis it's width into the Y and height into the Z. So in other words the front of your vehicle need to be pointing towards the X axis and the roof pointing on the Z axis and the doors on the Y axis in UDK. Now in your 3d app might be totally different for example in Softimage the front of the car points on the X axis and the hood points on the Y axis and the doors point on the Z axis. You will want to do the same as you did for scaling import it as a static mesh and make sure it as the correct alignment. Keep in mind that when you add bones you will need them aligned the same way as the mesh.


Texturing

Depending on your 3d app you can texture your model before or after you rig it. I would suggest for your first test model just use a standard uv map to avoid spending too much time to end up having to do it all over. Also I used a 1024^2 texture map and mapped the whole model using a "Unique UV polymesh" but using a box map for the whole mesh should be good enough.


Rigging

Now first thing when rigging is that you can use nulls or bones at least this is the case in Softimage. I prefer using nulls seeing there are no roots or effectors you have to mess with. Now make sure your bones align correctly in UDK they should align the same as your mesh when you open them in the editor. Try testing it using the root bone and apply the whole skin to the root bone so you can export and test it. You might have to rotate the null/bone like i did to a -90 so it aligns right in the editor.


Skinning

You need to attach your skin to the appropriate vertices. For example your root skin needs to attach to the vertices of the body of the vehicle. And your wheel skin needs to attach to each wheel according to its matching bone. Each 3d app has its own methods of attaching the skin to bones. In Softimage i attached the mesh to all the bones and reassigned the vertices to there appropriate bones.


Exporting

Part 3: Editor Setup

Part 4: Scripting

Video

SimpleCar Youtube


Project Files

SimpleCar.rar
Fileplanet
Megaupload
My Site "Last Resort Link" <uscript> Contents: The names are different SimpleCar/Humvee/VH_HMMWV because we did not want to go back and rename everything.

Folder SimpleCar Folder C.UDK.UDK.2009-12.UTGame.Content.Vehicles File VH_Humvee.upk

Folder C.UDK.UDK-2009-12.Development.Src.MyMod.Classes File UTVehicle_Humvee_Content.uc File UTVehicleFactory_Humvee.uc File UTVehicleHumvee.uc File UTVehicleHumveeWheel.uc

Folder Humvee Export Model File VH_HMMWV.psa File VH_HMMWV.PSK File X_ModelInfo_VH_HMMWV.LOG

Folder Humvee Model Source File Humbvee.ase File Humbvee.dae File Humbvee.fbx File Humbvee.mtl File Humbvee.obj File Humbvee.xsi File simplecartexture.bmp </uscript>