- Home /
Rigid Bodies & Colliders
Hi,
I have a room, with several objects in it. I have set up the floor as a box collider, and then set each of the objects as a rigid body and a mesh collider. When I go to play the file, the objects fall and bounce around the ground like they should, but they go through one another. How can I prevent this?
Thanks
Edit: After looking at more scenes, I believe I need to make those objects convex?
But when I do, I get the error: 'The hull has more than 255 polygons. This is invalid'
Answer by Jessy · Jan 09, 2011 at 10:05 PM
You can't prevent it. You need to either use primitive colliders, or model lower-res, convex versions of your objects, and use the lower-res meshes as mesh colliders.
If I have a triangular tube, how would I use multiple primitive colliders to accommodate the shape?
Answer by Mike 3 · Jan 09, 2011 at 10:05 PM
You're right about them needing to be convex hulls (or primitive colliders - if they're relatively box or sphere shaped, use a cube or sphere collider instead)
The issue with the hull having more than 255 polygons is that unity has run a simplification algorithm on your mesh, but is still unable to get it to 255 polygons as it's too complicated. You may need to make a simpler version of the mesh just to use as the collider (As you can use a separate mesh for collision purposes)
Answer by Eric5h5 · Jan 09, 2011 at 10:18 PM
Mesh colliders are generally used for static objects without rigidbodies. For moving objects, use primitive colliders, or compound primitive colliders. Only use convex mesh colliders if compound primitive colliders won't work.