How to make a cylinder collider inside a cylinder

Hi All!

So I’m making a game where the user is moving through a tunnel, which is a long cylinder. But I can’t seem to find a way to stop him from moving through the tunnel walls. What collider should I be using, and would it work stopping him from going from inside to outside?



There is a simple solution to this, although not pretty.

You can simulate this collider by the following:

  1. creating a box collider around your object

  2. then create another empty gameobject inside your object

  3. then add another box collider to that empty game object

  4. rotate the gameobject 45 degrees, which will turn the new box collider

  5. repeat as necessary for effect

I did it for a wine glass and it worked fine.

You have to use a mesh collider with the normals facing inwards.