Add a vehicle model and its parts¶
A vehicle is a skeletal mesh, a Blueprint class duplicated from the sedan, a vehicle Data Asset and its parts. Once a spawn point lists it, the car appears in the map with its seats, tank, engine, containers, Mechanics panel and parts, is saved with the world and is driven in co-op. The tutorial Add a vehicle follows the data steps on an example that keeps the sedan's mesh.
Steps¶
- Import the skeletal mesh on
Content/ZombieSurvival/Meshes/Vehicles/SKEL_Vehicle, the skeleton the vehicles share.- Its bones use the shared names:
body,wheel_fl...,door_*,window_*andwindow_*_broken,seat_*,headlights,taillights,hood,trunk... A model may use a subset. - Give it a physics asset with one body on
body: boxes only, no body on the wheels. - Add the sockets
Seat_<FL|FR|RL|RR>,Headlight_L,Headlight_R,Taillight_LandTaillight_R.
- Its bones use the shared names:
- For the class, duplicate
Blueprints/Vehicles/BP_Vehicle_Sedan. Driving, lamps and sounds come along. Set its mesh, its wheel setups (duplicate aBP_VehicleWheel_*pair for the radius and width), its mass, and itsVehicleDef. - For the data, duplicate
DataAssets/Vehicles/Childs/DA_Vehicle_Sedanand fill its fields (table below). - For the parts, copy one of
DataAssets/Vehicles/Parts/. A part is aPDA_VehiclePartDefplus its item. - Place a
Blueprints/World/BP_VehicleSpawnPointin the map where the car should stand, and add the vehicle data to itsVehicleDefs. Its arrow and box show the car.
A vehicle placed by hand in a map works but is not saved: it would come back twice. Place a spawn point instead.
| Field | What it does |
|---|---|
| Name | The vehicle's name. |
| Class | Standard, Utility or Sport. It decides which parts fit and which magazine teaches it. |
SeatSockets, SeatWindows |
One per seat. |
| Tank, consumption, torque | Fuel and drive. |
StartPartDefs |
One part per slot of E_VehiclePartSlot. Empty where the model has no such part. |
ContainerDefs |
Its containers: trunk, glove box, seats. Duplicate the sedan's DA_VehicleContainer_*: offset from the car, capacity, which seats reach it, or from outside with a reach. |
MechScheme |
The top view of the Mechanics panel. |
VehicleClassBP |
The Blueprint class of step 2. |
A PDA_VehiclePartDef holds its kind, its class, its quality, its removal and install tools, its
work time, its recommended level and its effect.
The numbers shared by every vehicle are in DA_VehicleSettings_Default, next to DA_Vehicle_Sedan.
Test it¶
- Start a new world on that map: open
Maps/L_Boot, press Play and choose NEW GAME. Vehicles appear once per new world. The Easy vehicles game option gives unlocked cars with the key in the ignition and a full tank. - Walk up to the car and press F: the outside radial offers get in, mechanics, trunk, locks, break a window, refuel and siphon.
- Get in, press I to start the engine, and drive with W A S D. E gets out.