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
0
Question by Webchef · Apr 15, 2014 at 05:51 PM · physicsmesh colliderrigidbody physics

How do I avoid mesh collider overlapping? (see image)

Hello, I´ve searched for days to solve this problem, but I can't find the right solution. This is the situation: I have a dice prefab with a mesh collider attached. The mesh collider component has a different mesh applied with lower poly count and the option convex is checked.

The rigidbody component options are:

  • mass=1

  • drag∠ular drag=0

  • use gravity=true

  • is kinematic=false

  • interpolate=none collision

  • detection=discrete

This is the code where I apply force on rolling the dice:

 // cycle through dice instances
         foreach(GameObject dice in diceInstanceList){
             // check if current dice is in dice stack, if not roll it
             if(!stackHandler.Contains(dice)){
                 // reset position
                 dice.transform.position = diceSpawn.position;
                 // reset rotation
                 dice.transform.Rotate(rndRotation());
                 // setup physics
                 dice.rigidbody.isKinematic = false;
                 dice.rigidbody.useGravity = true;
                 dice.rigidbody.mass = GamePlaySettings.diceMass;
                 dice.rigidbody.drag = GamePlaySettings.diceDrag;
                 dice.rigidbody.angularDrag = GamePlaySettings.diceAngularDrag;
                 dice.rigidbody.velocity = Vector3.zero;
                 // show dice
                 dice.renderer.enabled = true;
                 // push dice towards the board
                 dice.rigidbody.AddForce(transform.forward * GamePlaySettings.DiceForce);
             } // - is dice in stack?
         } // - foreach dice

Everything works fine but there are some overlapping issues. I roll (rigidbody.AddForce) 6 dice at the same time and the dice are overlapping each other. Look at the picture: alt text

How do I avoid these issues? What am I doing wrong?

Thanks for your help and time! Best, Arne

dicecolliderissue.jpg (484.7 kB)
Comment
Add comment · Show 1
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 OutCyder · Aug 29, 2018 at 06:09 PM 0
Share

These mesh colliders are waaaaaaaaaaaaaaaay too complex imo.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Apr 15, 2014 at 05:55 PM

The overlap seems severe. Let me suggest two things to try. Go to:

 Edit > Project Settings > Physics

Reduce or set to 0.0, Min Penetration For Penalty.

Go to:

 Edit > project Settings > Time

Reduce 'Fixed Timestep'. Try 0.01 to start.

Given how sever the overlap, I'm not convinced that either of these suggestions will address your problem, but it is worth a try.

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 Webchef · Apr 15, 2014 at 06:09 PM 0
Share

Hello robertbu! wow! that was a quick answer :)

I have set the penetration value to 0.0 and my fixed timestep is by 0.02. that gives me more realistic results! thanks a lot!

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

21 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

Related Questions

In which cases Mesh Colliders they should not be used? 1 Answer

Physics sphere slows down when rolling on two wire rails like pinball machine wireform ramp 0 Answers

Can't set position of Rigidbody precisely 0 Answers

Compute mesh inertia tensor failed - NOT the usual problem 0 Answers

Move rigidbody to position and still have forces act on it 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