Vehicles in nanos world implement Unreal's Wheeled Vehicle. The base Mesh of a vehicle is a Skeletal Mesh.
Preparing a Skeletal Mesh
There is no secret to import a Vehicle Skeletal Mesh. Any Skeletal Mesh with any Skeleton will work. The only "rule" is to it have 4 wheels bones, so the Vehicle systems can properly rotate them.
Take a look on one of the default Vehicles Skeleton:
This vehicle used in the example only has 4 bones below the root, for each Wheel:
Wheel_Rear_Right. Yours don't need to follow this naming, as the Wheel Bone names are set through Lua.
Preparing the Physical Asset
Another important step is setting up the Physics Asset for the Skeletal Mesh. If your Skeletal Mesh doesn't have it yet, you can create and assign a new one by right-clicking on the Skeletal Mesh and creating it:
Usually you only need one or a few simple boxes in the format of the Vehicle, you can add new ones by right clicking the root bone like that:
You will end up like that:
Do not add physics shapes to the Wheels! Usually you don't need it and it will only cause physics problems. In normal circumstances you only need to add collision shapes to the root bone!
Adding Dynamic Head & Tail Lights
It is possible to configure your Vehicle Materials to use the built-in Headlights and Taillights system:
For that, you will need to setup 4 parameters in your Vehicle's Material:
|A scalar which will be toggled |
|The Head Lights color|
|The Brake Lights color|
|The Reverse Lights color|
You should multiply/lerp all Colors with your texture mask and sum them into the Emissive pin. Use the LightsEnabled to do a final multiply on the result, like this:
In this example I multiplied the final result to 30 to give a bigger glow effect.
Exporting the Vehicle
The Exporting process follows the usual process of exporting assets to nanos world. Please follow the Importing Custom Assets Guide.