• 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
23
Question by Clonkex · Apr 27, 2014 at 11:41 PM · physicsforcemode

Difference between ForceMode.Force/Acceleration/Impulse/VelocityChange?

What is the difference between the four modes of ForceMode? I don't understand how you can apply a force in multiple ways. For example, if I put my hand on a car and push with a specific amount of force for 5 frames, what's the difference to hitting it with the same amount of force once each frame for 5 frames?

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

8 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by unity_qbQrrkGO2DjFvA · Aug 25, 2020 at 01:20 PM

Let's talk a little about physics.


Equations: Force = mass * acceleration, F = ma Impulse = change in momentum, J = (delta) mv Force = Impulse/time. = F = J/t


First, understand that adding an instant force or acceleration is mathematically impossible, so Unity applies the force/acceleration gradually over a time period for ForceMode.Force and ForceMode.Acceleration. This time period is normally 1 second. (meaning it technically adds an impulse... but enough of that)

Secondly, adding an instant impulse is mathematically possible because an impulse is a force applied over a time period. Same with ForceMode.VelocityChange.


Key: m = rigidbody mass Q = Vector3 number parameter t = Force application duration, normally 1 second in Unity


ForceMode.Force adds the exact force on the object on that Frame. Therefore, the rigidbody the force is exerted on will accelerate at an acceleration of Q/m for t seconds. If you know your integrals... acceleration is the first derivative of velocity and so the velocity of the object will gradually change by (Q/m)*t = Q/m for 1 second.


ForceMode.Impulse adds an instant impulse on the object on that frame. An impulse changes the momentum of the object, and because the mass stays the same, the velocity of the object instantly changes by Q/m.


ForceMode.Acceleration directly adds an acceleration to the object, regardless of its mass. So the change in velocity of the object becomes Qt = Q for 1 second. Equivalent to applying a ForceMode.Force of m*Q.


ForceMode.Velocity instantly changes the velocity of the object by Q, regardless of its mass. Equivalent of applying an Impulse of m*Q.



Summary: the main difference is whether the amount is applied instantly or not. Impulse and VelocityChange are instant (therefore not realistic in real life), ForceMode.Force and ForceMode.Acceleration are gradual along 1 second (but are misleading in name).

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
1

Answer by Leohoran · Aug 30, 2020 at 02:57 PM

My final answer

ForceMode.Force = Time.fixedDeltaTime * ForceMode.Impulse

ForceMode.Acceleration = Time.fixedDeltaTime * ForceMode.VelocityChange


ForceMode.Force = mass * velocityChange / timeChange

ForceMode.Impulse = mass * velocityChange / timeChange / Time.fixedDeltaTime

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
1

Answer by jimmy12day · Sep 24, 2020 at 09:06 AM

I created a cuboid in Unity and added rigidbody to the cuboid. Disabled gravity. Wrote a movable scrpit in Start() method to test the differences between these 4 forcemodes. Below is my test results and summary.


Equations

  • ForceMode.VelocityChange = Number of Force

  • ForceMode.Acceleration = Number of Force / PhysicsFramerate

  • ForceMode.Impulse = Number of Force / Mass

  • ForceMode.Force = Number of Force / Mass / PhysicsFramerate


Example

[ForceMultiplier= 200]

[Mass = 2 ]

[PhysicsFramerate = 50]

  • ForceMode.VelocityChange = 200= 200

  • ForceMode.Acceleration = 200 / 50 = 4

  • ForceMode.Impulse = 200 / 2 = 100

  • ForceMode.Force = 200 / 2 / 50 = 2


Explanation

  • Any force was effective in 1 second only. So if you call the force in the Start() method, it only applies 1 second. But it will apply every second in the Update()/FixedUpdate() method.

  • Unity locked the PhysicsFramerate to 50 frames per second (This is different from your application's framerate), which does not change.

  • If no other force applied(e.g. gravity), the speed will remain the same after the force applied.

  • Time.deltaTime represents the actual frame time, which can be used to make the acceleration smoother.

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 jimmy12day · Apr 07, 2021 at 08:00 AM 0
Share

Unity physics is very tricky, it is not real physics. In my unity test project, the speed increased immediately to the final speed instead of accelerating bit by bit over time. So I will suggest not to use unity physics for serious simulations.

avatar image oscarAbraham jimmy12day · Jun 26, 2021 at 04:28 PM 0
Share

I'm not disagreeing that the physics engine, which is Nvidia PhysX, shouldn't be used for very serious stuff; stuff like landing a rocket or plane safety simulations. What you're describing shouldn't happen if done properly, though. What was your code?

avatar image Clonkex jimmy12day · 3 hours ago 0
Share

Unity physics is as close to real physics as a game physics engine gets. It sounds like you just don't understand how to use it.

  • ‹
  • 1
  • 2

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

45 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

Related Questions

ForceMode.VelocityChange vs. simply adding to .velocity 0 Answers

Physics object slides while turning. 1 Answer

Trouble with spring platform 0 Answers

Foces only change during collision 1 Answer

Trying to Understand Rigidbody ForceMode Derivation 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