1.) Import in your own unique car model. Ensure wheels are separate from car chassis and that the pivots for each wheel are locally centered.
2.) Once you've imported in the UniCar package, navigate to the UniCar folder, then to the subdfolder named "Scenes". Within the Scenes folder you will find a scene named "Demo_Scene". Open it and you will observe a scene with a sandbox environment and a monster truck prefab placed in the scene. If you hit "Play" now you will immediately be able to drive as the Monster Truck. You can use this scene as a base to start with as it already has some needed elements within the scene.
3.) Locate the "Monster Truck" prefab in the scene and delete it. Locate the "Monster_Truck_Camera" prefab in the scene and delete it. We're going to be setting up a mid sized vehicle so this prefab won't be the best start.
4.) Navigate to the UniCar folder, now find the subfolder named "Vehicles" and locate the "Medium_Vehicle" prefab within that folder. Drag and drop this prefab into the current scene. Now would be a good time to save this scene out with your own scene naming convention.
5.) Navigate to the "UniCar->Prefabs->Cameras" folder and drag and drop the "Medium_Camera" prefab into the current scene. This is a camera setup ideally for the medium sized vehicle. You can still tweak and adjust all parameters to your own liking, but it's a good base to start with.
6.) Find the "Medium_Vehicle" prefab in the scene, open it's heirarchy and delete the "Medium_Vehicle_Proxy" object. This is simply the 3d mesh model of the placeholder car. Once it's deleted we can drag in our own custom car model. It's okay to break the prefab instance, in fact, that's what we want to do so we can create a new prefab from this.
7.) Now drag and drop your own car model directly into the "Medium_Vehicle" prefab object. Ensure it resides inside of the heirarchy of the prefab group. Rename the root prefab that's currently named "Medium_Vehicle", to any unique naming convention that works for your project.
8.) If you select the root prefab, you'll notice the colliders and wheelColliders for our new vehicle are a bit off. This is a small bit of manual tweaking to get things just right for your own custom car. We'll start by lining up the chassis box colliders to more closely match the chassis of our vehicle.
9.) Once the chassis colliders are lined up and scaled properly we will move on to the wheel Colliders. Take a few moments to line each wheel collider up to each visual art wheel. Ensure they are centered properly on to each corresponding visual wheel and that the radius of the wheel Collider matches the radius of the art wheels. For adjusting the wheel colliders I usually put the scene in wireframe mode, and use the orthographic side and front camera views. This makes matching the wheel colliders to the wheel visuals much easier.
10.) Once you have all of the vehicle colliders matching in scale to the visual car model, let's move on to hooking our visual wheels up to the physical wheel colliders. Find all (four) of your vehicle's wheels in the model's heirarchy. Shift-Select all four of them at once, navigate to the Inspector and click on "Add Component". In the search box for adding a component, search for the WheelAlignment.cs script and click it to apply it to all four wheels at once. With all four wheels still selected and the script applied, you will see all of the empty slots for the other needed prefabs. Navigate to the UniCar-> Prefabs -> VisualFX folder and drag and drop each visual Particle FX prefab into it's corresponding slot on the script. i.e. drop the GrassVFX onto the Grass Particle FX slot on the script.
11.) Now individually select each of the visual art wheels, and one at a time, drag the corresponding wheel collider onto the slot for Corresponding Collider on the WheelAlignment.cs script. This will tell each visual art wheel which of the physics wheels is the matching one. This will allow the visual wheels to turn and rotate in the exact way their physics wheels do.
12.) Find the "Skidmarks" object within the scene. The script on this object has a pulldown menu named "Vehicle Type". Make sure to set this pulldown menu to accurately reflect the size of the vehicle you are creating. This will determine the width of the skidmarks for your particular car. You can also adjust the widths for each type of vehicle as well as the intensity of the appearance of the skidmarks.
13.) Your new custom vehicle should be fully driveable now. You will want to look over all of the customizations and experiment with different settings.
Download the PC Demo
* Please use the "Contact" page to report bugs.
Setting Up Your Own Vehicle in UniCar