-
Notifications
You must be signed in to change notification settings - Fork 6
Home
- Custom Bogies
- Collider Setup
- Coupler & Buffer Setup
- Custom Locomotive Simulation Setup
- Locomotive Interiors & Cab Controls
- Lighting, Animation, & Effects
- VR Support
The car template and exporter Unity package is available in a zip file under releases. If you need to install the Unity Editor, version 2019.2.21 or 2019.4.22 is recommended (do NOT use one of the 2020 or newer versions, this could cause compatibility issues).
One issue to look out for when creating your model: having your mesh or materials named the same as the car prefab can cause a conflict when loading the car into the game. Make sure to use different names for your assets and prefab!
The following steps assume that you've installed the Unity Editor and have created a new project. Before proceeding, if you want your vehicles to be visible in VR, follow the steps on the VR Support Page
Steps:
-
Open your Unity project. Import CUSTOM_CAR_LOADER.unitypackage into your project (right-click on your Assets folder in the Project tab and select Import Package > Custom package...).
-
You should now have a folder called DVCustomCarLoader under your project Assets. The most important folders you'll need to be familiar with are Prefabs and _CARS. To begin creating your model, create a new folder under _CARS with the name of your custom car. This will be your main "workspace" for the car. Right click the new folder in the tree or open it and right click in the asset thumbnail panel, and select Create > Scene from the menu.
- Open your newly created scene (you can delete or leave the default camera and light objects, they won't affect anything). Open the Prefabs folder in the Project/assets panel and drag car_template into the scene. The transform of the new car_template in the scene should be at the origin (zero position), default rotation (all zero angles), with a scale of one in each direction.
- Right click the car_template you just created in the scene and select Unpack Prefab Completely. This will make sure that the template is preserved for the future. Once unpacked, rename the car_template root transform in the scene to any name that describes your car (this won't be the final name of the car in-game).
-
Now you can modify your car object to align with your vision. You'll likely want to replace the meshes first; the template is set up with several different LOD meshes, which can be deleted if you only have a single level of detail (The LODs are managed by an LODGroup component on the root transform - if you only have one LOD, delete the LODGroup). Next, you can align your bogies, couplers, chains, etc. so that they match your new mesh. After aligning the bogies, click AlignBogieColliders on the TrainCarSetup script (on the root transform of your model) to make sure the bogie colliders match the positions of the bogies (see the Bogies and Colliders pages for more details).
-
Select your car in the scene and under the TrainCarSetup component, click Export Car. This will bring up the car validator which will run some basic checks on your car structure. If any issues are found, they will be indicated here. Click Continue Export to proceed to the final export window.
-
Click "Finalize TrainCar settings" once you are ready to export. You can read [HOW TO EXPORT] or [HOW TO AVOID ERRORS] within the window if you are having any trouble. You can check "Open build folder after export" if you want to see the results of the export.
-
The export window should open to your Derail Valley directory if it exists within the C:/ drive. If not, navigate to your Derail Valley install location and find the custom cars folder:
.../Derail Valley/Mods/DVCustomCarLoader/Cars/ -
Create a new folder inside of the Cars folder to hold your new car. (You can reuse the same folder if this is not the first time exporting; the previous contents will be cleared though!). Make sure you select or open the folder for your car and that the name is displayed in the bottom of the selection dialog.
- The export process might take a minute or so to complete. Once your car is finished exporting though, it is ready to use inside of Derail Valley! It can be spawned using the car spawner mode of the comms remote - make sure it is enabled in the ESC menu settings.