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 model to import.
Drag the model onto the scene.
When we play the scene now the object falls through the scene.
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
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
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