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 /
avatar image
0
Question by Loui_Studios · Nov 16, 2016 at 01:09 PM · collisioncolliderstriggersrail

Curved 3d Collider

In my game I am using splines to create rails that the player can grind on.

The problem I have is that each rail needs one long, continuous collider that spans the whole length of the rail.

alt text

For short, or relatively straight rails, I just have to place one box collider that covers the whole rail, but If I want to use curved rails, I would need to use multiple colliders, which would dismount the player as they leave one collider and my OnTriggerExit() function is called.

alt text

I've been trying to use the EdgeCollider2d collider instead, as you can configure the points to create one curved collider, but I have been having trouble setting it up in my scenes.

Is there a way I can create a 3d curved collider for each of my rails?

Or alternately, is there a way that I could write a OnNotTriggerStay() command? -So that I can just place box colliders along my rail as per usual.

Please don't link me to other questions, I've already done lots of research.

Thanks! All help is appreciated!

capture2.jpg (24.1 kB)
capture.jpg (25.6 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by tanoshimi · Nov 16, 2016 at 02:35 PM

You simply need a mesh collider that uses the same curved rail mesh as you use for your renderer: https://docs.unity3d.com/Manual/class-MeshCollider.html

Comment
Add comment · Show 3 · 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 Loui_Studios · Nov 16, 2016 at 02:43 PM 0
Share

Hm. This would be quite hard as the player can also grind on some of the level's geometry. So the mesh collider I would access would be the same collider as the entire level's. Detaching the geometry itself for each level would also be more work than it's worth.

But the idea of using a mesh collider is pretty promising. Any chance I can 'generate' a mesh for my spline? it would be difficult, sure, but It would make adding rails, and letting my users make their own rails, super easy!

avatar image tanoshimi Loui_Studios · Nov 16, 2016 at 05:12 PM 0
Share

Sure - you can programmatically create a mesh for the mesh collider from your spline by specifying each vertex and triangle, exactly the same way as you'd create a procedural mesh for rendering. https://docs.unity3d.com/$$anonymous$$anual/Example-CreatingaBillboardPlane.html

avatar image Loui_Studios tanoshimi · Nov 16, 2016 at 05:14 PM 0
Share

Thanks! This'll help out so much!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How do I create AI with a good side and evil side? 0 Answers

Does OnTriggerStay don't detect a collision with a non-trigger collider? 1 Answer

How do I use colliders and/or triggers to end the game? 1 Answer

OnTriggerEnter Multiple Collisions Activating. I tried many variations, Please help (Java) 3 Answers

changing gravity OnTriggerEnter 1 Answer


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