Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by Hyperactive · Nov 18, 2016 at 11:32 AM · colliderplayercylindertunnel

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?

Thanks!

Hyper.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by alphadogware · Jan 25, 2018 at 11:21 AM

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.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hyperactive · Jan 25, 2018 at 12:14 PM 1
Share

A year later, but still on point. This is exactly what I did! I used about 16 boxes to make the entire circles, and it works well.

avatar image alphadogware Hyperactive · Jan 25, 2018 at 02:07 PM 0
Share

Did you have any issues with the oncollisionenter being called too many times? I had to setup a variable that held the delta time for oncollision calls. This is because I was playing a sound on oncollision enter and it was being called too many times cause of all of the extra colliders.

avatar image Hyperactive alphadogware · Jan 25, 2018 at 04:30 PM 0
Share

Funny you mention that, I did have issues with triggers. But then I just disabled them all together and just used the boxes as walls to stop the user. I did have sounds attached to them, but it just went crazy so I just gave up on that idea! So you just had some kind of bool isPlaying = true to check when the audio is playing so it doesn't play again until another collision?

Show more comments
avatar image
0

Answer by chum10 · Nov 18, 2016 at 11:57 AM

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

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hyperactive · Nov 18, 2016 at 12:06 PM 0
Share

Sounds good, but how to reverse normals in Unity?

avatar image chum10 Hyperactive · Nov 18, 2016 at 12:28 PM 0
Share

I don't think you can unless you are building the mesh procedurally. The easiest way would be to create that mesh collider in your favourite 3D modelling software.

avatar image Hyperactive chum10 · Nov 18, 2016 at 12:32 PM 0
Share

$$anonymous$$akes sense. I made the tunnel cylinder in a 3D software, and the normals are facing inwards because the texture of the tunnel is inside the tunnel in Unity. Which means I can just use the same cylinder, just add a mesh collider to it? I tried this, and having a collider on the player, and I still just go through the walls.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

72 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How To Ignore A Tag 1 Answer

Trigger is not detecting tag 2 Answers

C# bool active when player collides with object 1 Answer

VRChat Player falls through floor regardless of colliders 0 Answers

2D Character Falling Through Ground 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges