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
0
Question by Hotshot10101 · Oct 22, 2016 at 06:25 PM · physicsdice

Dice Not Behaving to Normal Physics

I have created 2 cubes to use as dice.

I drop them from a height with a random rotation.

When they hit the plane collider that I have created as the surface for the dice to fall on to, they will roll around a little and then finally come to a stop. This is when I detect what side is facing up.

The problem is that the dice are not behaving like real dice would.

For example sometimes the dice will land on an edge and the very slowly fall to a face.

Sometimes they will just stay on the edge.

Sometimes they will fall almost all the way to a flat side, but still not quite be all the way down so I can't detect that they have achieved a side.

The physics settings for the game are all default so the gravity setting is -9.81.

The dice have a rigid body on them with these values:

mass: 1 drag: 0 angular drag: 0 use gravity checked is kinematic not checked interpolate: none collision detect: discrete

I think those are the defaults.

I have tried making the mass very large and that did not change how they behaved.

If you throw real dice and they are not spinning around they fall to a side almost instantly. This is the behavior that I would like.

Can someone tell me how to make that happen?

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

Answer by clickmatch · May 04, 2017 at 05:20 PM

This is an older post, but in case anyone else wants info. Step 1 is apply a physical material to the collider. This allows you to tweak friction and bouncyness. You can also add one to the rolling surface, which makes a big difference, and the phys material can be set for those values to interact.

I also did a script for nudging and kicking stuck die. if it couldn't detect the side, it would return a zero.. and on the update I'd nudge it:

 if(side == 0) {
                 if(attemptCounter < 5) {
                     Nudge();
                 } else {
                     Roll();
                 }
             } else {
 etc..

 public void Roll() {
     isRolling = true;
     awaitingResult = true;
     rb.AddForce(Random.onUnitSphere * forceAmount, forceMode);
     rb.AddTorque(Random.onUnitSphere * torqueAmount, forceMode);
     attemptCounter++;
 }
 public void Nudge() {
     isRolling = true;
     awaitingResult = true;
     rb.AddForce(Random.onUnitSphere * 0.2f, forceMode);
     rb.AddTorque(Random.onUnitSphere * 0.2f, forceMode);
     attemptCounter++;
 }
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 Hotshot10101 · May 04, 2017 at 05:27 PM 0
Share

Thank you for your response.

avatar image
0

Answer by Hotshot10101 · May 04, 2017 at 05:26 PM

I ended up doing similar things, but still feel like it doesn't match real world dice very well.

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 clickmatch · May 04, 2017 at 05:28 PM 0
Share

I agree. We did a game here involving that, and it's close, they are satisfied, but it's not as realistic as it could be.

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

88 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 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

Rolling a 3D Dice: Detect which number faces up? 4 Answers

Mixing physics and path... 0 Answers

Why/How 2d tower of blocks collapse? 0 Answers

cant get raycast to work with tags 1 Answer

getting two errors and none of the fixes ive found online work or are relevant to my code CS0019 and CS1061 (full errors below) 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