Importing Vehicles in UT2004

What follows is an overview of the process needed to create, import, and set a vehicle up in the Unreal Editor
for use in Unreal Tournament 2004. 

Placement and Pivots

Create your model, texture, etc. and place the center of the vehicle chassis (with wheels, but not weapons) at world 0,0,0 in MAX,
facing the positive X direction which in the TOP viewport of MAX means the vehicle is pointing to the right.

MOST IMPORTANTLY, make sure the pivot point is in the most logical place of the vehicle, as vehicle physics 
will use this point as the center of mass. The center of mass can be tweaked in code, but you should try to make a good estimate.

MAX cannot be undone!!!

Next comes two steps...
Make sure you are in the right coordinate system by clicking on the REFERENCE COORDINATE SYSTEM at the top/middle 
of the max interface, and changing it to WORLD. Next, make sure the transform of the vehicle is correct by going to the Reset XForm button in the
UTILITIES tab in MAX. The polygons of your vehicle may invert upon doing this. If so, simply go to POLYGON
sub-object mode (make sure ignore backfacing is OFF) and select all
polys, and invert them with the SURFACE PROPERTIES: NORMALS: Flip button. Go back to the modifier stack in MAX and you'll see the XForm modifier 
on top of your editable mesh. Click on the reset XForm modifier to exit it, and collapse the stack.

If at some point in your progress you find the pivot has been rotated errantly, you can fix this by going to the
Hierarchy tab in MAX, clicking on AFFECT PIVOT ONLY, and clicking on the RESET: TRANSFORM button. RESET XForm
always fixes transform probs, but reset pivot may not...


If your vehicle has wheels, make sure they are equidistant (leftside/rightside) from the centerline of the vehicle
before export, as it will handle oddly if the left wheels are closer to the vehicle center than the right wheels.
Give the tires and any suspension parts you want animated unique names for a programmer to later hook up in code.

If you want the vehicle to have an active suspension (whereby the wheel position will affect the suspension parts)
you will need to place the rotation points of the suspension parts so they rotate correctly in Max. 

Place the wheels where you want them to be on the suspension parts, and make the wheel a child of the VEHICLE, and
the suspension arm a child of the VEHICLE also. DO NOT link the tire to the suspension part! 

For the wheel physics to work, these must be both individual children of the vehicle. 

You will need to get the radius of a wheel (if different sized wheels, you will need all radii) for your programming guru to put into the engine. Do this by
going to the Create Tab in MAX, Helpers/Tape, and drag from the center of the wheel to the perimeter.


If you want your vehicle to have weapon points on it, you will need to create Dummy objects at these points, and
give them useable names for a programmer to hook them up. 

Make sure you reset the pivot of the Dummy object in the Hierarchy tab in MAX. If the weapon pivot is not aligned to the vehicle pivot, your weapon will fire in the wrong
direction. Make the weapon point Dummy object a CHILD of the vehicle chassis. A brief aside....

The tank turret in it's entirety is a weapon, not a vehicle, so the tank chassis was exported with just the bottom
half, and two dummy objects as children of it: one dummy for the main turret, and one for the machinegun up top.

Even if your vehicle has no physical model for a weapon (like the Raptor or Manta) you will still need to create an
object or a polygon and name it, pivot reset it, and place it where you want the vehicle to fire from. VERY IMPORTANT!!
If this is the type of weapon your vehicle has, you will need to make sure it is OUTSIDE of the vehicle, at least
some. Otherwise, you will have problems and errors. A transparent texture must be created and placed on this object.

Animated weapons (like the Leviathan Singularity Projector) still use Dummy objects to hook onto a vehicle like other
vehicle weapons, but must be given animation. To do this, make sure your objects have the correct pivot directions,
and animate them in MAX. Export them separate from the vehicle by making a RefPose and an animation file. This is outlined later.

Before exporting any vehicle, delete everything you DON'T want in the exported file. If you have a spline, a
construction plane, even a light in the export it'll screw up the export, or add unnecessary size to the export. 

Multiple Textures

If you want multiple textures on a vehicle, you will need to set material ID's on the respective parts of the vehicle you want different textures on. First, create a MULTI-SUB OBJECT material type in max, and set the number of maps you want and in the DIFFUSE slots of each map navigate to the texture you want on the polys that will soon be assigned each material ID. You can now set the parts of your vehicle to different ID's by going to either face or element SUB-OBJECT mode in max, and select the parts you want the first material on, and going to the ID tab in sub-object mode, you enter the number 1 and press enter. This assigns the first material to the selected faces. For the second material, select faces, go to the ID field again, type in 2 and press enter. Do this for all textures you want on a vehicle. Place this MULTI-SUB OBJECT material type on the vehicle. Each texture should only show up on the parts with the corresponding material ID's.

Some parts of the exporter have been explained elsewhere, so I'll give a cursory overview as I go along of what is needed.
Make sure all material ID's are either eliminated in the mesh OR in place on the objects where you want them! On export, if you have 
multiple material ID's on an object and don't actually use more than one material it will still show multiple material slots on the object in the Unreal Editor.

Before exporting...

Make sure all parts are linked child to parent as you want.
Make sure all unneeded scene elements are gone.
Make sure all names of parts are meaningful, and NOT duplicated (most important for Dummy objects)...
If you want to use consistent file paths, and settings, check the boxes beside these options in the 
Utilities/ActorX/Actor X- Setup.

Set an output path...

output folder
C:\This is where I put my Vehicles\New vehicles folder

Give your vehicle a filename...

mesh file name

Get a snapshot of the mesh for the engine to use...
Save mesh/refpose

If your main vehicle chassis has animations, you will need to do the following...

Set your frameslider in MAX to zero just to make sure you are where you want to be...
Give an animation File name to export (the overall name of the animations used for one vehicle)...

animation file name

Set a name for the current animation you want to export...

animation sequence name

Set an animation range of frames to export...

animation range

All is now set. Press the Digest Animation button.
Click on the Animation manager button. Here, you can edit the properties of each animation you just digested.
Click on the animation/animations on the left side, click the --> button to move it/them to the right side.

When ready to save, click on the Save or Save As button. All is now ready for a programmer to hook up things in 
code, but you can at least preview the vehicle and animation in the editor. 


In UT2K4, vehicle collision is handled in two ways simultaneously-

1.)Karma physics between two vehicles
2.)Weapon hits on vehicles (for this, I'll use the Leviathan mesh, to coincide with the vehicle anim tutorial)

For Karma, the information is set up in the editor itself. This will also be discussed later.
For weapon hits, you create a staticmesh shell representing your vehicle, with the pivot in the same place as the actual 
vehicle pivot. HOWEVER...the staticmesh for weapon collision must now be facing the NEGATIVE X direction, which, from the top
viewport of MAX, will be TO THE LEFT! 

 If you wish, you can use the actual model of your vehicle, but if your game is memory limited, a lower poly object may be in order. Export the vehicle using Save Mesh/Refpose, including the weapon hit mesh. The hookup for the weapon hit vehicle mesh will have to be done by a programmer, so name it something meaningful.


Open the editor, and click on the Animations Tab.

Go to File/Mesh Import/WhereverYouOutputYourMesh, and click on the MyNewVehicle.psk file you find there. This is
the mesh and hierarchy data only. You'll get a prompt saying a new object has been brought in. Click it. GIVE ANYTHING
AND EVERYTHING YOU BRING INTO THE EDITOR A UNIQUE NAME!!! This is CRUCIAL! All package, group, and item names must be
different from each other! You can bring multiple things into a group, and have multiple groups in a package, but all parts, groups, package names must be unique. Period.

Go back to File/Animation Import/wherever you output your animation, and click on the MyNewVehicleANIMS.psa.
Give a Package name and a File name to your animation/s. 

Now, to see the animations for the chassis, (weapon animations must be connected to your vehicle by a programmer, but
you can still view the weapon animation alone) you click on the ANIMATION SET selection box...

...and look for your MyNewVehicleANIMS animation set. HIGHLIGHT IT SO IT IS BLUE.

Now click on the  "LINK ANIMATION TO MESH" icon...

Now click on the mesh selection box, find your mesh, and click on your mesh name.

This links the animation info to the mesh. Drag the editor animation slider
back and forth and you should see your animation going.

Now...getting back to Karma collision...

Once the vehicle is brought in and any animations for it are linked to the mesh, 
click on the MESH tab of the animation editing interface... on the COLLISION drop-down, and in the BONE NAME field, enter the name of the Chassis object. bBlockKarma bBlockNonZeroExtent and bBlockZeroExtent 
should all be set respective to what effect you want. 

At the top of the editor interface, go to View/Collision to see the box that you are about to create. All collision objects will be visible, including the static mesh collision data.
Start with a Radii size for x/y/z to get the box started. Edit the sizes until the collision box dimensions are snug (the purple lines) up to the sides of the vehicle.

You will want to set LOD levels for your vehicle which allow the LOD changes to not be too noticeable in-game. There is 
no magic number for it, so enjoy.

If you have to import multiple times for tweaks, you will certainly find the MESH/Copy Mesh Properties and MESH/Paste Mesh Properties functions useful!! LOD info is not kept by this method, though.

At this point, all other hook-ups are up to your friendly neighborhood programmer, so that's it for the vehicle tutorial.

Roll Out!!