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
2
Question by holman8er · Jan 03, 2012 at 11:07 PM · rigidbodysphererollingphyics

How to prevent a sphere collider from rolling for prolonged time

I'm working on a golf game and I'm having some problems with the ball rolling for prolonged periods of time. I've tried adjusting the settings under the rigid body as well as the values for the physics material that it uses. However, the ball still seems to roll for prolonged periods of time no matter what I do. The only difference is, the speed at which it rolls. Although cranking the angular drag up seems to reduce the rolling speed, it still continues to roll for long periods of time.

Any ideas as to how I can address this issue? Would I be better off tweaking the rigid body settings, or tweaking the physics material settings? I'm sure it will take a bit of time to customize it for our purposes, but if somebody could point me in the right direction, it would be much appreciated! Thank you.

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 edhalsim · Dec 31, 2015 at 09:49 AM 0
Share

@holman8er, what did you finally decide to do? I'm trying to simulate a golf ball rolling on a putting green and I'm seeing the same behavior; the ball slows down, but never stops rolling completely. The only thing I've tried that actually stops the ball is to increase both drag and angularDrag each time OnCollisionStay is called, but that seems wrong. Thanks.

1 Reply

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

Answer by aldonaletto · Jan 03, 2012 at 11:39 PM

You could increase the rigidbody.drag as well, but this could kill the velocity while in the air. I think you could try to reduce the velocity and angularVelocity in OnCollisionStay, thus it would fly freely but loose energy quickly when rolling on the ground:

var velDamp: float = 0.01; var aVelDamp: float = 0.01;

function OnCollisionStay(){ rigidbody.velocity = 1 - velDamp; rigidbody.angularVelocity = 1 - aVelDamp; }

Another alternative could be to increase the drag and angularDrag in OnCollisionEnter, thus the behaviour in the air would not be affected:

var dragInc: float = 0.2; var aDragInc: float = 0.2;

function OnCollisionEnter(){ rigidbody.drag = 1 + dragInc; rigidbody.angularDrag = 1 + aDragInc; }

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 holman8er · Jan 03, 2012 at 11:52 PM 0
Share

Thanks Aldon, we're definiteley on the same page here. I have in fact tried increasing the angular drag OnTriggerEnter, and it seemed to work better than normal. However, when the ball is on a slope in the terrain, it continues to roll, just not as fast. This is especially a problem when the ball goes into a sand trap and lands on a slope. It doesn't matter if that slope is steep, the ball should still stick into the sand and only roll for a very brief period of time (if it all). But ins$$anonymous$$d, it rolls down the slope extremley slowly for an extended period of time.

avatar image aldonaletto · Jan 04, 2012 at 12:53 AM 1
Share

You should increase rigidbody.drag as well: it opposes to the movement, stopping the ball early. You could also try to use OnCollisionStay ins$$anonymous$$d of OnCollisionEnter: notice that the drag factors are increased exponentially each time the event occurs.

avatar image aldonaletto · Jan 04, 2012 at 01:09 AM 1
Share

Important note: don't let rigidbody.drag = 0, since zero raised to any exponent will still be zero. Set rigidbody.drag to a small value, 0.1 or lower, and use OnCollisionStay as I suggested in my last comment: I tried it, and the ball stopped like in a tar pit with these settings. You can even change the dragInc factor depending on the material the ball collided with - this 0.2 value is good for sand, and maybe 0.05 could be better for grass, for instance.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to have a sphere roll/be affected by friction 0 Answers

rolling ball movement on different axis 0 Answers

Activate physics when animation ends 0 Answers

Rotating sphere with rigidbody attached 1 Answer

Smooth Player Ball Rolling 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