Colliders 101

My learning of Unity is coming along well, but one thing keeps on befuddling the b’jeebus out of me…colliders.

I would like to know under which circumstances colliders actually collide with each other, in the sense that they don’t allow other colliders to pass through them.

My rigidbodys will somtimes go through each other and my imported object (even with the ‘generate colliders’ box ticked) will let everything else phase through it. Boxes with box colliders will also sometimes go right through each other.

Is there a ‘Colliders 101’ i can absorb, or can one of you incredibly helpful people please explain how colliders work?

Also if i use a ‘Character Controller’, will i need to script collisions?

Thank you as always, Tom :slight_smile:

1 Answer

1

Well, as far as ‘Colliders 101’ courses, you can’t go past the Unity Reference manual! Have a good read of the page on Phyisics Components.

As for particular tips, tricks, and things to look out for, the most common newbie mistake with colliders comes from the fact that mesh colliders do not collide with other mesh colliders. Primitive colliders (boxes, spheres and capsules) can all collide with each other, as well as any mesh collider. Mesh colliders can collide with primitives, but must be marked as ‘Convex’ before they will collide with other Mesh Colliders, but this has the unfortunate side-effect of removing any cavities in the mesh. It also doesn’t work on meshes with more than 255 triangles. Because of this, Mesh Colliders are usually only good for static geometry (levels, buildings), and for any other objects you should try to use simplified Compound Colliders (several primitives parented to the same rigidbody) instead of Mesh Colliders.

The page you linked to was good to read, but your own text pretty much answered most of my questions reguarding colliders. Thanks muchly for your time and supreme-brain-knowledge :)

One last thing, where can i read about how to get a 'character controller' to collide with other colliders? In the Ref Manual it said i need scripts, i may need pointing in he right diraction :)

Wow, thank you :) The problem im having with riged bodies, is that i can't get them to stay on a 2D plane (just X + Y axis)...i understand i may have better luck with a character controller. Tom :)

Well, you can always just get rid of an object's movement in one axis if you need 2-d motion- rigidbody.velocity = new Vector3(rigidbody.velocity.x, 0, rigidbody.velocity.z); transform.position = new Vector3(transform.position.x, objectHeight, transform.position.z);

That looks as though it may be alot easier. Seriously, thanks again :)