Skip to main content

Importing 3D Models and add a Mesh and Colliders to stop them falling through the floor

This guide will show how to import a 3D model and add a simple mesh and collider to it to stop it falling through other objects.

When you import an external 3D model it usually won't have a mesh added to it to detect and handle collisions with other objects. This results in the object falling through other objects.

In this lesson you will:

  • Import an external 3D model
  • Add the model to a scene
  • Add a Cube mesh to the model (you can use other meshs if they are provided)
  • Add a collider to the object
  • Add a Rigidbody (or CharacterController to an object) to apply physics and detect basic collisions.

Find a 3D model to import. kenney.nl has a number of creative commons licenced models and other assets to use. There is an assets pack from kenney.nl linked at the bottom of the page.

Unzip the file and drag the folder into your assets / project panel.

Find a model to import.

In this case it is the basicCharacter model in kenney_blockycharacters_updated > Models

Drag the model onto the scene.

Add a Rigidbody (or character controller) to the object and press play.

When we play the scene now the object falls through the scene.

We need to add a mesh filter to the object.

By default the is no mesh attached.

We can add a custom mesh here if one has been provided.

For a lot of our objects adding a cube mesh will suffice.

Click on the target on the right .

Search for Cube

Double click the cube mesh to add it

The object will still fall through the environment.

We need to add a collider to the object

Now to handle collision detection we need to add a collider to an object. Most already have them added but we can also customise them

On the player object select Add Component and add a Box Collider.

Note the box collider is way too big, we need to resize it.

Now we need to edit the box collider. Click the edit collider button

You can now edit the size of the box collider.

Use the squares in the middle of each face to resize the collider.

Now when we hit play the character will fall and detect the collision with the environment