-
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
-
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). 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).
-
Once you've aligned things to your liking, turn your car into a prefab by dragging the root of the object from the scene hierarchy into your workspace folder in the project view. If successful, your object should turn blue in the scene hierarchy. Select the root object in the scene again, and under the TrainCarSetup component click CreateAssetBundleForTrainCar.
-
Select your car prefab in the scene and under the TrainCarSetup component, click Export Car. This will bring up a new tool window.
-
Check the settings for the car. If anything doesn't look right, you can click "Close" to return to the main editor.
- Identifier is the unique name of your car in-game.
- Car underlying type is exactly what it says, and is where buffers and default bogies are pulled from. Pick the type that matches your car the closest.
-
Click "Finalize TrainCar settings" once you are satisfied with your new car's info. You can read [HOW TO EXPORT] or [HOW TO AVOID ERRORS] within the window if you are having any trouble. Finally, click Export Train Car to proceed to the last step.
-
The export window should popup to your games directory if it exists within the C:/ directory. 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 new mode on the Comms Remote.
Freznosis has made a video demonstration of the export process using the original car loader package.
Original notes: "(BEWARE: Video is unedited, I don't have the time to edit it. It is also missing some of the popup windows, but they are self explanatory.)"