Unity - Car Body

There are some fantastic car models available on the Unity Asset Store. One such model is by Mehdi Rabiee. You can get it here on the Asset Store:

https://assetstore.unity.com/packages/3d/vehicles/land/sports-car-model-and-shader-15813

It's a bit old now, as the release date was 2014. But it still works well for our purposes.

So, download and install the car model above. (You might see a warning at the bottom if Unity about Shaders. Don't worry about this.) In the Project area of Unity, you should see a folder called CarModel-1. Click inside of this and then inside of the Models folder:

Project area showing a download of a car body from the Unity Asset Store

Inside of the Models folder should be three items: folders called Materials and Textures, as well as a model called CarModel-1. Click on the CarModel-1 item to select it. Now have a look at the Inspector on the right. You should see this:

CarModel-1 Import Settings

On the Materials tab, click the dropdown for Use External Materials (Legacy). Change it to Use Embedded Material:

Menu showing Use Embedded Material selected

Now click the Apply button at the bottom. The Inspector should change to this:

As you can see, all the boxes say None (Material). So, click the button that says Extract Materials. You'll see a file dialog appear. Select the Materials folder and then click the Select Folder button:

In the Inspector, you'll then see the Material slots all filled in:

The Inspector showing the car Import Settings with materials added

To see where these are coming from, click inside of the Materials folder in the Projects area at the bottom of Unity, just to the left of CarModel-1 in the Models folder. You should see this:

Materials in a project folder

Two of the materials haven't come out very well. One is 01-Default, which is the actual color of the car, and the other is LightGlass, which is the color used for the headlights and taillights. Click on 01-Default. In the Inspector on the right, change the Albedo color to anything you like:

We went for an Hexidecimal value of 005FA8 for the Albedo. This is a blue color. We set the Metallic slider to 0.45, and the Smoothness to 0.55.

Now click on the LightGlass material. If you have a look at the Inspector on the right, you'll see the shader it is using at the top:

Changing the shader for a material

The shader it's using is a Hard Surface one. Click the dropdown and change it to Standard:

Again, you can change the Albedo. We went for a Hexadecimal value of B07070. Also, click the Source dropdown box and change it to Albedo Alpha. Now set the Metallic slider to 0.65, and the Smoothness to 0.7.

With the Materials set, drag and drop CarModel-1 from the Models folder into your Scene. Move the Y position up a little bit (green arrow). It will look something like this:

The car body in Unity Scene view

As you can see, though, it has a front left tyre. We need to get rid of this. Have a look in the Hierarchy. You should see a CarModel-1 item. It will be blue:

The reason it's blue is because it's a prefab. However, you can't delete things from a prefab when it's packed. So you need to unpack it. This is easy enough. Right-click on CarModel-1 in the Hierarchy. From the menu that appears, select Prefab > Unpack:

A Unity menu showing the Prefab > Unpack option

When you unpack a prefab, it becomes an ordinary game object that you can manipulate. So, expand CarModel-1 and click on the Circle005 item, which is the tyre:

Car tyre selected in the hierarchy

With the front tyre selected, press the delete key on your keyboard. The tyre will be gone.

A car body showing in Unity's scene view

Nearly there!

Now drag and drop CarModel-1 onto CAR-ROOT:

Select CarModel-1 after you've dragged it into the CAR-ROOT parent. In the Inspector on the right, set the Position and Scale values to these:

Position

X: 0
Y: 0.45
Z: 0.17

Scale

X: 2
Y: 2
Z: 2

Your Inspector should look like this:

And your Scene should look like this (hopefully):

Car body sitting on our wheels

Now play your game and take your beautiful new car for a spin. It should look something like this, in the short video below:

 

Not bad, hey! It's not too late to change the color of the car, by the way. Just click on the 01-Default material again and select a new Albedo color.

Also, play around with the Main Camera positions. In the screenshot below, we changed the car color to orange, and we set the following values for the camera:

Position

X: 0
Y: 1
Z: -6.5

Rotation

X: 6.7
Y: 0.4
Z: 0

The rear view of the car

In the next lesson below, we'll add some brakes and some audio to the car.

<--Back to the Unity 3D Course Contents Page