• 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 Maddogc · Sep 16, 2011 at 02:09 PM · rigidbodyboxcollider

Sphere jumps over Box Collider seams

Helo everyone,

i'm creating a game with a rolling ball driven by forces, which has a rigidbody and a sphere collider attached. My floor is made with compound box colliders.

Problem: When the ball rolls over box collider seams it jumps up. I tried to overlap and to snap them but neither helped...

How can i solve this?

Can anybody help please

thx

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
0
Best Answer

Answer by Maddogc · Oct 06, 2011 at 10:07 AM

Helo again,

in the meanwhile i found a workaround to solve this problem.

Solution: I've put a collider as trigger over the affected seams which freezes y position of rigidbody constraints when the ball rolls through.

This is the code:

 void OnTriggerStay(Collider other)
 {
     other.gameObject.rigidbody.constraints = RigidbodyConstraints.FreezePositionY;
 }
 
 void OnTriggerExit(Collider other)
 {
     other.gameObject.rigidbody.constraints = RigidbodyConstraints.None;        
 }


Unfortunately i didn't get any answers yet.

For any suggestions or advices -> any other "native/better" and not patch ones like mine;) would be appreciated.

thx a lot

Comment
Add comment · Show 2 · 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 splinelab · Dec 19, 2011 at 09:27 AM 0
Share

I've exactly the same problem. Your solution works but I'd like to understand the reason for this unwanted behavior

avatar image theness_ · May 05, 2015 at 10:07 PM 0
Share

I know this is old but for future viewers: apparently if you set the material Dynamic friction and static friction to 0, and also set friction combined to $$anonymous$$imal, it fix this glitch.

avatar image
0

Answer by 00jknight · Feb 08, 2017 at 09:28 AM

I've found a really good solution.

Use 2 Colliders. If Mesh collider, typically one convex, one not. Otherwise just make a giant, simplified box collider overtop of your bad seams. When your on top of a collider with seams, you collide with the "giant" collider, otherwise you fall through the giant collider.

In detail: Put the convex/giant collider on a "seam fix" layer, and the other collider on a "seam bad" layer. Have 2 layers for your "player/ball". One is the regular player layer, the other is the "player seam fix" layer. Setup your Physics Manager so your player collides with "seam bad" but not "seam fix" and "player seam fix" collides with "seam fix" and not "seam bad".

In Update, use a BoxCast/SphereCast/RayCast or w/e to determine if your against the "seam bad" collider, if you are switch to "seam fix" else stay on player regular.

The "seam fix" layer is a simplified collider without the seam problem, so this script essentially makes it so you only collide with the giant collider if your on top of the bad seam collider, so it allows you to fall through the giant collider otherwise.

Comment
Add comment · Show 1 · 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 Raptosauru5 · Apr 06, 2020 at 09:59 PM 0
Share

This is the most popular solution around, however how will you fix it if the boxes are even slightly rotated or if you are working with some sorts of up/down ramps?

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

RigidBody's Bug???How to solve it??? 0 Answers

Box collider on a moving object-shopping cart 3 Answers

strange behaviour after object collision 1 Answer

Box Ridigbody rotates faster left than right 1 Answer

i wanna prevent my collider from falling down flat when climbing slope 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