Importing object to scene and make them collidable?

Hi all,

I am importing building models into my scene, but the imported structures they are not collidable like the ground and other objects already in the scene (the player avatar is walking right through them).

What extra steps are needed to make these imported objects “solid” like they should be?

Thanks!

Add a collider. In the menu you can find it under component ->physics.

1 Like

In my case this is a hollow object (a house) with stairs up to the second floor. The colliding needs to occur on the house walls and the second story floor for example.

Is a collider only for solid objects?

You are probably going to have to break up your model into pieces. Separate the walls from the floor, stairs from the floor and walls, etc. Keeping it as one solid collider will create issues.

Just found this thread. Not sure if you still need help since this was from months ago. But for the purposes of other people searching and finding this, here you go…

The colliders provided by Unity are mostly pretty simple primitives. Any object that needs to interact physically with another object usually needs a collision model. For objects like hollow houses that need something more complex than a primitive, the collision model is often created in the same 3D model package as the main model. It is essentially a very simplified version of the model, that contains roughly the same volume and boundaries, but with none of the fine detail. The fewer polys/verts in the collision mesh, the less memory it uses, the faster the game runs.

You could create this same thing by creating a bunch of mesh colliders in Unity, but depending on the object, it may be easier and quicker to create it in an outside 3D package and import it into Unity. Mesh colliders use more memory than Unity’s default primitive colliders. However if it would take dozens of colliders to create a proper collision mesh, it may be more memory-efficient to import a separate collision mesh. Depends on the situation–experiment and find out.

I believe the way to set an imported model as a collision model in Unity is:
Add the model to be used for collision to a directory in your Unity project
In Unity, select the object that needs collision
In the Inspector, click add component–>physics–>mesh collider
On the line that says Mesh that has a textbox saying “None (Mesh)” click the circle icon to the right and in the “select mesh” popup, choose the model to be used for collision

There are other rules and guidelines for collision, some general, some specific to Unity. See more info in the following links:

Unity documentation - mesh collider:

Tutorial on collision basics in Unity:
http://www.binpress.com/tutorial/unity-3d-collisions-basics/114
Unity Answers - how do I supply a custom collision mesh?:

Unity support forums - mesh guidelines:

Making a collision model can be considered a technical modeling task. Often this is done by the modeler, or maybe by engineers/programmers or other people working on the more technical side of development. As a modeler, I have sometimes but not always been asked to provide collision models.

I hope this all helps collect information about collision meshes in Unity in a central location. Disclaimer: I’m a modeler, not a programmer/engineer, so if anyone with more technical knowledge than I has anything to correct or add, please do so.

4 Likes

Found this helpful but may have an easier way.
Once the model is in the assets, select the model
In the Inspector under “Model” tab, under “Meshes” enable (check) the “Generate Colliders”
It will take a few seconds to minutes depending upon the complexity.
When the model is put into the scene it will have collisions.

5 Likes

This is good but it will wrap a collider around the whole model, so if it is a room for example, you won’t be able to get in it if coming from the outside.

1 Like

Help! The add component isn’t there, what should i do?

This works and I have a very complex model that is hollow and has many different disconnected parts and this worked perfectly!