Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by starstriker1 · Sep 26, 2013 at 06:30 PM · physicscollidermesh colliderinterpenetration

Preventing Convex Mesh Colliders from Interpenetrating

I'm making a 2.5D puzzle game. As part of the game there are ice cubes that slide around, run into each other, and stack.

The ice cubes have a rigidbody that is is locked for movement on the Z axis and for rotation on the X and Y axis. Instead of using box colliders, I use convex mesh colliders that are basically cubes with the edges cut off. This is to stop the cubes from getting caught on stray edges in the environment. Avoiding getting snagged on stray edges is important. For example, if there's a whole bunch of these cubes in a row and you want to slide another cube on top of them, the sliding cube can't be getting snagged on the cubes below.

Here's where the problem comes in. While for the most part behaviour is exactly what I want, occasionally the cubes will start to clip into one another, often rotating into the other cube. Eventually the interpenetration will stop and the cubes will "pop" away from each other, which is wildly disruptive to the puzzle design and a very ugly, obvious visual artifact besides.

I don't want to have to use box colliders here because they work very poorly when the cubes are stacked, but this behaviour with the mesh colliders is unworkable. What might cause this, and how can I stop it? Alternatively, is there another way I could avoid the snagging behaviour that's causing issues for me?

Here are some of the steps I've already taken:

  • I've verified that the mesh collider is actually convex in 3DS MAX

  • Unity mesh collider settings are set to Convex

  • I've changed the rigidbody collision settings from Discrete to Continuous and even Continuous Dynamic, but that hasn't reduced the incidence of penetration.

  • I've verified that interpenetration happens even without the custom scripts I'm applying to the ice cubes.

  • The scale on the collider is not being changed at runtime, and is set to (1,1,1)

  • I've attempted to replace the mesh collider with a set of primitive box/capsule colliders in roughly the same shape, but the results weren't good and snagging was a problem.

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

Answer by starstriker1 · Oct 01, 2013 at 09:07 PM

http://answers.unity3d.com/questions/11568/how-can-i-keep-small-dynamic-physics-objects-from.html

The answer to that question was applicable to my situation.

I placed two box colliders inside the ice cube such that they were completely enveloped by the mesh collider but still were very close to the original shape. In this case,covering almost all the same volume except for the beveled edges, with a small .1 unit gap between the mesh collider and the new box colliders.

They ultimely "reinforced" the shape and prevented any interpenetration from going too far into the mesh. Since any interpenetration is minimal, the popping effect doesn't happen, but I still get the advantage of the mesh collider not getting snagged on hard edges.

Comment
Add comment · 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
1

Answer by inZayne · Sep 30, 2013 at 12:35 PM

I've been making a 2D game using 2D ToolKit for a while now that also relies heavily on physics. Interpenetration has been a large problem for me, but I've noticed a pattern. Interpenetration seems to occur for me when the surface area of one of the colliders is too small. I originally had the problem with regular box colliders, I'd set the depth to something really thin as I figured the Z-axis wasn't important. I fixed the interpenetartion issues here by increasing the Z scale of the boxes to 1.

I later ran into a similar issue when I made a triangle shaped mesh collider, if the triangle hit a surface with one of the pointy edges it wouldn't rest on the surface but would jitter about. Like you I modeled the meshes with rounded corners and also increased the Z scale even further (up to 15 before it started to work properly). So maybe increasing the Z scale would fix your problem aswell, to increase the surface area for those narrow corners of the boxes.

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 starstriker1 · Oct 01, 2013 at 07:14 PM 0
Share

Gave it a shot, and unfortunately it didn't seem to have an effect. $$anonymous$$y mesh colliders are already fairly large on the Z scale since they contain the full 3D model shape (which is 3x3x3).

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

16 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

Related Questions

Cant fix my collider problem on an object, help me up :) 1 Answer

Problems with mesh collider 0 Answers

Mesh collider and jitter 1 Answer

How can I prevent collider interpenetration? 1 Answer

Assigning new sharedMesh to mesh collider every frame doesn't work? 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