Asteroids – Adding a Model to Unity

Basics_Model008

 

I have made a basic space ship model in blender you can use for this tutorial:

Model (zip file)

It is easy enough to add the model to Unity.

Select assets from the top of the screen and then select import new asset. Select the model you want to import.

Basics_Model001.JPG
Import an Asset
Basics_Model002.JPG
Selecting the File

The model will appear in the project folder window and the inspector should change to look something like the picture below.

Basics_Model003.JPG
Inspector

Deselect import cameras and lamps because we don’t need them (we don’t have either with the model anyway). Also select the generate collider setting as we do want our model to have a collider. We will discuss colliders in more detail in a future part.

Basics_Model005.JPG
Settings

Press the apply button to save the changes

Basics_Model006.JPG
Apply Button

To add the model to the game scene drag it from the project folder to the hierarchy. It will appear in the scene.

Basics_Model007
Hierarchy
Basics_Model008
Scene View

Make sure the model’s position is set to 0, 0, 0.

Basics_Model009
Setting Position to (0, 0, 0)

We also need to change the rotation of the model so it matches the game scene axis. If you look at the scene view we want the ship to face the same direction as the blue arrow (Z axis). To do this we rotate the model 90 degrees around the Y axis.

Basics_Model010
Rotating the Model 90 Degrees Around Y
Basics_Model011.JPG
Ship in Scene View

The model is now set up.

Just a few more things we need to do before finishing the tutorial part. Select the camera and move it to 0, 20, 0. Set its rotation to 90, 0, 0.

Basics_Model012.JPG
Camera Transform

Next Change the “Clear Flags” setting to Solid Color and change the Background colour to black.

Basics_Model013.JPG
Camera Settings

We should also change the light. Position it at (0, 20, -10) and set it’s rotation to (45, 30, 0).

Basics_Model014.JPG
Position Light

You may notice the detail on the ship is completely lost. This is because the intensity of the light is too high for the plane white texture of the ship. To change this this select the directional light in the hierarchy. In the inspector change the intensity to 0.6. Now we can make out the detail on the ship.

Basics_Model015.JPG
Light Settings

Your game view should look something like this.

Basics_Model016
Game View

Next time we will look at parent and child objects.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s