Vehicles are special geometry objects, which are driven by scripts, which also determine the functionality.
Vehicles are complex objects that need careful setup in the 3d package. Basically, the setup should be applicable to any package. Polycounts need to be carefully calculated, as extended functionality increase object (drawcall) and polycount drastically.
All vehicles have to face towards +Y in the coordinate system (front looking towards up in top view).
Example: rotation and position of the chassis pivot:
Every moving part needs to be a separate object within the 3d package. The pivot needs to be set correctly within the 3d package, as the engine will use the object's individual pivot to make transformations.
Linked objects have the advantage that only the root needs to be selected and exported. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.
Every moving part needs to be a separate object within the 3d package. The pivot needs to be set correctly within the 3d package because the engine will use the object's individual pivot to make transformations.
Naming is needed for scripts to identify the objects and interact with them. The examples below reflect the asset names used in Crysis - they can be different for other games.
The wheel proxy must be simple enough to be recognized as a cylinder by physics. Support for an additional detailed proxy (if the wheel's shape demands it) will follow.
Vehicles are complex objects and simplifying collision calculation is very important for performance. Therefore it is advisable to create two physics proxies. one is for collision with the terrain and characters and one for collision with bullets, grenades etc...
You can have a different number of LOD levels for different parts of the vehicle. i.e; the chassis of a car may have 4 LOD levels whereas the door, being a more simple object, has only 2.
LOD switching is based on screen size, smaller objects will switch earlier than big ones. Keep this in mind when doing LOD's.
The damage model for vehicles is a separate asset which replaces the vehicles on destruction. It can be a simple static model or a complex pre-broken object.
To manage objects easier, it is recommended to sort LOD's via layers.
You can test if your animations are exported and playing correctly by loading the vehicle to the character editor, and clicking on the animation on the right.
Vehicles are very complex objects and can cause major problems if the exporting is not done carefully. To avoid complications in the scene:
Setting up named selection sets can help you in re-exporting your assets.
In order to work properly, a vehicle script is required. Otherwise the vehicle can only be judged visually as a Geom Entity.
Please refer to the Vehicle Editor section for information on the vehicle editor.
There are some useful commands you can use to check your asset and see if it works as expected. Some of these are listed below (you can turn off any of these drawing modes by entering 0 after the command instead of the number given here).
CVar | Description |
---|---|
p_draw_helpers 1 | Used to check physique proxies. |
e_debug_draw 1 | Used to check LOD's. Using this variable you can see the bounding box of the object, see the name of it, |
e_debug_draw 2 | Displays polycount only for the given LOD. |
e_debug_draw 3 | Different LOD levels are represented in different colors, so you can clearly see the transition between two LOD levels. |
e_debug_draw 5 | Shows how many material IDs are in use on the given objects. |
e_lod_min 0 - 6 | Shows the specified LOD number as LOD0 - very handy for debugging LOD's in the engine. |