• 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 Raddeo · Jul 25, 2015 at 03:54 PM · rigidbodyforcedrag

How exactly does Rigidbody Drag works?

I'm working on script w$$anonymous$$ch would allow me to move rigidbody to given targed position using forces. I'm planning to do it by building control system with PID controller in Matlab, find correct parameters there and then script it in Unity3d. But to do t$$anonymous$$s I'd need to know transfer function, i.e. how exactly force and parameters like mass or drag influence the movement of my rigidbody. I believe that I can easily calculate such function if only applied force is to be considered. But drag is a problem to me, because I don't know how exactly does it work. I'm not physicist, I have only some basic knowledge about it, so it's quite difficult for me to understand drag in Unity3d. I've tried to test it against drag equations for small Reynolds numbers (F = -d*v) by giving my object constant velocity in Start() function and then adding following force in every FixedUpdate

 GetComponent<Rigidbody> ().AddForce (GetComponent<Rigidbody> ().drag * GetComponent<Rigidbody>().velocity);

If Unity3d's drag had followed mentioned equation, then object's velocity would stay constant, as force opposing drag force would be applied all the time. And it worked perfectly for low values of drag (drag < 0) and mass equal to 1. But changing mass or drag parameter lead to changes in object's velocity, so t$$anonymous$$s equation was no longer correct.

Does anyone know how exaclty Unity3d's drag parameter influence movement of rigidbody? Is there any kind of equation w$$anonymous$$ch I could use in my system?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Syndicated79 · Jan 03, 2017 at 08:51 AM

For what it is worth, I ran into a similar problem when working with Unity's drag parameter. The drag parameter calculation that Unity uses does not seem to behave according to the Generalized Drag Calculation (w$$anonymous$$ch is fair considering that Unity is a Game Engine)

I resorted to setting the drag coefficient to 0 on the rigidbody and implemented the above mentioned calculation. In addition, I also included Density of Air Calculation into my drag calculation.

Using the two aforementioned calculations I ended up with a model that corresponded very well with the actual data I had.

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
0

Answer by FariAnderson · Jan 06, 2021 at 08:36 PM


here's a unity forum link of an Answer from NASA :-)

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
0

Answer by NicolasSouza-NIckSDev · Jan 24, 2022 at 07:28 PM

i searched for a lot of time and make some calculations for all t$$anonymous$$s days, and i figurer out how it wokrs (or the most closelly of it)

bascaally the calc of gravity and drag it´s:

 Vector3 GForce = rb.velocity + Physics.Gravity*Time.fixedDeltaTime;
 //T$$anonymous$$s wil be our gravity Force applied to the RigidBody
 //Similar to rb.velocity += Physics.Gravity*Time.fixedDeltaTime
 //but insted to apply to rigidbody we aplly the Drag Force, so:
 
 Vector3 vWithDrag = GForce * (GForce*(Time.fixedDeltaTIme*rb.drag));
 
 //and finnaly we aplly to it:
 rb.velocity = vWithDrag;

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 Bunny83 · Jan 25, 2022 at 12:12 AM 0
Share

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

6 People are following this question.

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

Related Questions

Drag around riggidbodies with a "pin" 0 Answers

How can i set AddRelativeForce relative to how fast/slow im moving my mouse? 2 Answers

adding drag to a relative force 0 Answers

Touch controlled ice puck 0 Answers

Calculating the force required (Rigidbody) 3 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