UDN
Search public documentation:
SettingUpVehicles
日本語訳
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
UE3 Home > Gameplay Elements > Setting Up Vehicles
Setting Up Vehicles
Modeling Vehicles - Setup and Rigging
- The root bone must be weighted to the main rigid chassis of the vehicle.
- The vehicle should point down the +X axis and have +Z as up, and the root `chassis' bone should point down the +X axis and have +Z as up as well. It is a good idea to get the vehicle pointing in the right direction before adding any bones.
- Any other bones for wheels and suspension should be direct children of the chassis bone. Do not make wheel bones children of suspension bones - leave them as children of the chassis.
- Place each tire bone where you want the wheel to rotate (both roll and steering). One axis of the bone should point along the roll axis and another should point along the steering axis (you can tell the engine which axis to use once it has been imported and you are setting up the AnimTree).
- When exporting the vehicle, make sure the wheel bones are moved down to the fullest extension of the suspension.
- Any weapons will need bones to be able to rotate, both Pitch and Yaw (can be the same bone for both or separate). For vehicle with multiple seats for passengers, each seat should have a bone which the passenger occupying that seat will be attached to (if visible). Also, the camera(s) and any effects (such as muzzle flashes and spawning projectiles, thruster effects, damage effects, etc.) used by the vehicle will need sockets to be attached to. In many cases, these will not require bones at the exact location here the socket will be located, but it often makes setting up the sockets much quicker if they are.


Vehicle Export
Vehicle Import and Setup






Create A Physics Asset
Once you have imported your vehicle mesh into the engine, you need to create a Physics Asset for it, to define the collision shape for it. To do this you need to use PhAT (the Physics Asset editing Tool). The only body that is important for a Physics Asset used with a vehicle is the root `chassis' bone. You do not need to create physics bodies for any other bones - you don't need to create joints for wheels for example. Wheel simulation is all handled by the vehicle physics code. Only the chassis body will be created as a physics object, and used for the vehicle collision. PhysicsAssets are used for line check and player collision against the vehicle though, so you may want to create collision shapes for other bones to get more accurate collision - particularly if those bones are going to move (doors, flaps, turrets etc). The mass and inertia of a vehicle in the game is calculated based on the volume of the chassis collision geometry, and the Density property of the PhysicalMaterial applied to the chassis BodySetup. To modify the mass of a vehicle in the game you can either modify the PhysicalMaterial, or adjust the MassScale property of the chassis BodySetup.Create An Anim Tree
Although you may not be playing animation on your vehicle, you will still need to create an AnimTree for it to work properly. This is because AnimTrees also contain SkelControls to move individual bones around procedurally in the game. The UE3 vehicle system uses a special type of bone controller to move the wheel bones to match the underlying simulation. You can find more information on wheel SkelControls on the Using Skeletal Controllers page. See the AnimTree Editor User Guide for more information about basic AnimTree setup and using the editor.Setting Up Wheels

Setting Up Suspension Bones
As well as having a control to move the wheels as you drive, you may want to add some additional controls to bones that control suspension arms. There is a type of SkelControl called a `look at' controller, which tells the bone to always point one axis towards another object, bone, or point in space. This node is used to control suspension bones.
Setting Up Damage Nodes
Vehicles extending from the UTVehicle class can make use of the localized damage system. This allows vehicles to show progressive damage in the locations where the damage is being done. The system makes use of morph targets as well as special skeletal controllers, the UTSkelControl_Damage, UTSkelControl_DamageHinge, and UTSkelControl_DamageSpring nodes.Morph Nodes
Morph targets can be used to alter the appearance of the vehicle as it gets damaged by blending from the undamaged mesh to any number of damaged meshes. Usually, you will have one morph target for each area of the vehicle you want to be able to take damage individually of the rest of the vehicle, e.g. for a car-like vehicle you might have morph targets for the hood, each of the fenders, the rear, each of the doors, etc. This way, when another vehicle runs into the left front fender, the damage system can blend in that morph target an only that fender will appear damaged.



Damage Nodes
Skeletal controllers can be used with the damage system to cause parts to break off as they get damaged as well as explode when the vehicle is destroyed. The basic damage controller is the UTSkelControl_Damage. This node is mainly used for spawning broken vehicle parts when the vehicle dies, but can also be used for breaking pieces off the vehicle as it becomes more and more dmamaged. The UTSkelControl_DamageHinge and UTSkelControl_DamageSpring nodes are mainly used for breaking pieces off the vehicle as it becomes more damaged. They also add the ability to have the associated vehicle parts become more flappy or looser (depending ont he type of node used, hinge or spring) until they break off. The node gets linked to a specifc bone and damage caused in the location of that bone (or closer to it than any other bone) will be applied to the associated damage controller.
- On Damage Active - If true, the damage and breaking functionality is enabled for this control.
- Control Str Follows Health - If true, the control strength once active is determined by the current health of the controller. Otherwise it is always full strength once active.
- Damage Bone Scale - The scale to set the associated bone too when the controller breaks apart. Usually (0,0,0) to hide the part completely.
- Damage Max - The amount of damage the controller can take before it is considered dead; essentially, this is the maximum health of the controller.
- Activation Threshold - The health ratio (current health / maximum health) below which the controller becomes active.
- Break Mesh - The StaticMesh to spawn when this controller breaks.
- Break Threshold - The control strength above which the controller looks the begin breaking.
- Break Time - The amount of time it takes to go from breaking to completely broken.
- Default Break Dir - The direction used to determine the velocity of the broken off piece.
- Damage Scale - The scale to be used for the spawned vehicle part. Useful for mirroring the same StaticMesh when being used for multiple parts on opposite sides of the vehicle.
- PS_Damage On Break - The ParticleSystem to spawn when the controller breaks apart, e.g. a small explosion effect.
- PS_Damage Trail - The ParticleSystem to attach to the broken off part as a trail, e.g. a smoke trail effect.
- On Death Active - If true, the death breaking functionality is enabled for this control.
- On Death Use For Secondary Explosion - If true, this damage control is used for the secondary death explosion of the vehicle instead of the primary death.
- Death Percent To Actually Spawn - The percent chance (0 to 1) that this control will actually spawn a broken off part when the vehicle dies.
- Death Bone Scale - The scale to set the associated bone too when the controller breaks apart. Usually (0,0,0) to hide the part completely.
- Death Static Mesh - The StaticMesh to spawn when this controller breaks.
- Death Impulse Dir - The direction used to determine the velocity of the broken off piece.
- Death Scale - The scale to be used for the spawned vehicle part. Useful for mirroring the same StaticMesh when being used for multiple parts on opposite sides of the vehicle.
- PS_Death On Break - The ParticleSystem to spawn when the controller breaks apart on death, e.g. a small explosion effect.
- PS_Death Trail - The ParticleSystem to attach to the broken off part as a trail, e.g. a smoke trail effect.
Setting Up Sockets
Sockets were mentioned previously as being used as attachment points for player cameras and weapon muzzle flashes as well as any additional effects the vehicle may require. Sockets are essentially locators parented to a specific bone which can named and then be offset and given their own individual rotation. This provides an easy way to attach or spawn items at specific locations. Sockets are added to a skeletal mesh inside of UnrealEd through the AnimSet Editor. Press the




Creating Projectiles
A projectile is the physical representation of the weapon fire. The visual component of Projectiles in Unreal are simply particle systems. Creating particle sytems for projectiles is a straightforward process similar to making any other particle system. Essentially, you want to set up a particle system that recreates how you want to the projectile to appear while in flight. The particle system can be made up of as many emitters as necessary to get the desired effect. Some examples of projectile particle systems are shown below:


Setting Up Muzzle Flashes
Muzzle flashes are used to simulate the projectile being expelled from the barrel of the weapon, like the flash you would see when a gun is fired in real life. The weapon system in Unreal uses a particle system as the visual component of a muzzle flash. As with projectiles, the particle system for a muzzle flash can be made up of as many emitters as necessary to get the desired look. Some examples of muzzle flash particle systems are shown below:


For Programmers
- The name of the SkeletalMesh.
- The name of the PhysicsAsset.
- The name of the AnimTree.
- The name of each wheel bone.
- The name of each SkelControlWheel.
- The radius of each wheel.
Creating The Script File
Below is an example of how you would enter all of the needed information into an UnrealScript class (.uc) file for your vehicle:// Saved as MyVehicle.uc class MyVehicle extends SVehicle; defaultproperties { Begin Object Name=SVehicleMesh SkeletalMesh=SkeletalMesh'VehiclePackage.VehicleMesh' AnimTreeTemplate=AnimTree'VehiclePackage.VehicleAnimTree' PhysicsAsset=PhysicsAsset'VehiclePackage.VehiclePhysAsset' End Object Begin Object Class=SVehicleWheel Name=RRWheel BoneName="R_R_Tire" SkelControlName="R_R_Tire_Cont" WheelRadius=25 End Object Wheels(0)=RRWheel }
Performance: Tuning Vehicles
There are many parameters which control how a vehicle handles. Some are per-wheel parameters which reside in each SVehicleWheel object, whereas those that affect the entire vehicle are in the SVehicle and SVehicleSim objects. An explanation of each parameters is available on the Vehicles Technical Guide page.Useful Console Commands
One feature of the Unreal Engine which is very useful for tuning vehicles is theeditactor
console command. While driving the vehicle you can type editactor class=svehicle
at the console, and a property window should pop up. This allows you to tune almost all of the parameters as you drive around, making iteration very quick.