• 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
6
Question by boddole · Oct 03, 2014 at 05:29 AM · physicsrigidbodyprogrammingforcemode

Trying to Understand Rigidbody ForceMode Derivation

Hello everyone, I am trying to get a better understanding how the ForceMode formulas work (not "What they do") with Rigidbody.AddForce().

Take for example Acceleration and VelocityChange, both of which ignore mass to makes things more simple. Lets also say that my added velocity is (0,0,0.1).

I observe that Acceleration will take 1 second to apply the full force, and VelocityChange will do the same each Fixed Update. What I don't understand is the formula used to derive the difference (and I fully appreciate I just may be doing / understanding the math completely wrong).

Acceleration uses distance/time^2 (0.1/0.02^2). Which, using the vector above gives (0,0,250)...huh? VelocityChange uses distance/time (0.1/0.2). Which, using the vector above comes to (0,0,5)...again, what?

I don't understand how the values outputted by the formula ends up moving the rigidbody in the way it does. Any clarification is greatly appreciated.

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 Benproductions1 · Oct 04, 2014 at 11:10 AM 1
Share

@boddole Please accept the answer that answered your question. If you don't know how, watch the tutorial video on the right.

3 Replies

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

Answer by Benproductions1 · Oct 03, 2014 at 09:21 AM

You're confusing the difference between a unit and a formula. It might be helpful if you understood the basics of physics, aka classical mechanics. You might also want to read the documentation of each of the force modes more carefully. ForceMode.Acceleration is over a period of time, while VelocityChange is instance (which is not what you described).

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 boddole · Oct 04, 2014 at 12:50 AM 0
Share

Thank you for the link, I'll make sure to look into it.

avatar image
36

Answer by Bunny83 · Oct 04, 2014 at 02:46 AM

Like Ben said it's all straight forward:

ForceMode.VelocityChange does exactly what the name suggests. So those two lines do exactly the same:

 // The passed "force" parameter is in m/s which is added instantly to the velocity
 rigidbody.AddForce(Vector3.forward*1.0f,ForceMode.VelocityChange);
 
 rigidbody.velocity += Vector3.forward*1.0f;

ForceMode.Acceleration is ment to be applied every FixedUpdate. So the result you get after 1 second is the same as VelocityChange. The next two lines are exactly the same:

 // The passed "force" is in m/s². If applied every fixed frame the accumulated velocity will increased by "force" m/s every second
 rigidbody.AddForce(Vector3.forward*1.0f,ForceMode.Acceleration);
 
 rigidbody.velocity += Vector3.forward*1.0f * Time.fixedDeltaTime;

ForceMode.Force and ForceMode.Impulse just do the same but also divide by the mass of the object:

 // "force" is in newton (kg*m/s²)
 rigidbody.AddForce(Vector3.forward*1.0f,ForceMode.Force);
 
 rigidbody.velocity += Vector3.forward*1.0f * Time.fixedDeltaTime / (rigidbody.mass);

ForceMode.Impulse:

 // "force" is a impulse / momentum which is in kg*m/s
 rigidbody.AddForce(Vector3.forward*1.0f,ForceMode.Impulse);
 
 rigidbody.velocity += Vector3.forward*1.0f / rigidbody.mass;

edit
Two quick crosslinks to how drag is applied:

  • http://answers.unity3d.com/questions/819273/force-to-velocity-scaling.html#answer-819474

  • http://forum.unity3d.com/threads/drag-factor-what-is-it.85504/#post-1827892

Comment
Add comment · Show 5 · 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 unityBerserker · Jul 27, 2019 at 08:00 AM 4
Share

Based on your answer, I created drawings to help you understand AddForce ()

alt text

addforce-eng-units.png (21.1 kB)
avatar image unityBerserker · Jul 27, 2019 at 08:01 AM 2
Share

alt text

addforce-eng-invoke.png (41.4 kB)
avatar image unityBerserker · Jul 27, 2019 at 08:02 AM 3
Share

alt text

addforce-velocity-change-eng.png (52.8 kB)
avatar image unityBerserker · Jul 27, 2019 at 08:03 AM 3
Share

Summary alt text

addforce-eng.png (49.0 kB)
avatar image Bunny83 · Jul 27, 2019 at 10:31 AM 2
Share

If someone stops by, please keep in $$anonymous$$d that you can vote comments too, thank you ^^.

avatar image
0

Answer by Clonkex · Nov 14, 2015 at 12:57 PM

If you're still confused for any reason, I asked a similar question with some good answers:

  • http://answers.unity3d.com/questions/696068/difference-between-forcemodeforceaccelerationimpul.html

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

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

31 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

Related Questions

Multiple Cars not working 1 Answer

Addforce - bug with jump 2 Answers

Slow Down the ball speed in every collesion 1 Answer

Unexpected "Jumping" Behavior 0 Answers

RigidBodies and "Slipping" Prevention 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