Holes in imported Blender objects not recognized by Unity physics?

I’m new to Unity and Blender, but I haven’t found an answer to this. I created a 2 level structure in Blender using cubes scaled in the horizontal and vertical to make floors. I then used a cylinder to create a frame and a slightly smaller cylinder to punch a hole through the floor and frame objects. I then disabled the punch cylinder leaving behind an opening where it had been. So far, so good, so I imported the floor and frame objects (not the punch) into Unity.

I applied colliders and gravity and I tried playing the VR project in Unity and everything worked normally except when I walked out over the opening, I didn’t fall through. I created a purple sphere and placed it in mid-air over the opening. When I played the VR again, the ball fell to the level of the upper floor and stopped. I could push it below the level of the upper floor and it would then fall down to the level of the lower floor. The physics engine does not seem to recognize the opening as a hole. I am including a picture to clarify my description. What is the fix for this issue?

If your Blender objects are being used as scenario only (they won’t move nor have physics themselves) then disable “Convex” in the MeshCollider components.

If those objects must also be dynamic objects (with a Rigidbody) then “Convex” must be enabled, but that will bring back your problem. You would need to decompose your non-convex objects into smaller convex objects so you can assign an individual convex collider to each piece.

Thanks for the response Edy. Sounds like I may need to look into options for splitting the floor into different pieces.

I’m surprised there isn’t a more elegant solution to this. It would seem like a fairly common thing to have doorways, windows, or hatches that you needed to move through but would need to have physics for the surrounding walls and floors to prevent you from moving through. I expected there to be a way to tell the physics to match the visible shape of the object.

You can have that, by using non-convex mesh colliders. You just cannot move them with a rigidbody. As long as your walls / floors are static, no issue.

Probably I haven’t explained it correctly. You need “Convex” on those physics objects that have Rigidbody, that is, they move themselves in the scene: i.e vehicles, props, characters, doors, etc.

You don’t need “Convex” on those physics objects that are static scenario and just provide collisions: floor, walls, buildings, roads, bridges, trees, etc. These use Collider components only, without a Rigidbody, and may contain holes, windows, etc. In these objects typically it’s enough to add a MeshCollider component (“Convex” disabled) to the same visual object.

Thanks for your tips. I had used box collider and hadn’t seen the mesh collider. I swapped them out and convex was disabled by default. Everything seems to be working as expected now.

1 Like