• 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
5
Question by rd42 · May 26, 2010 at 01:42 PM · physics

Rigidbody.AddForce is in what units?

What units is Rigidbody.AddForce in?

For example, are dir.x in m/s^2:

myRigidBody.AddForce (dir.x, dir.y, 0, ForceMode.Acceleration);
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
5
Best Answer

Answer by SteveFSP · May 26, 2010 at 01:58 PM

Yes, the unit of distance in Unity is meters per default. So acceleration will be in meters per second squared. Force in newtons. Velocity in meters per second.

Notice that the only constant in the system which dictates this is the default gravity - which you can change in the player settings. By doing so, you can make the units whatever you want - they are all just relative.

In the Unity editor: Edit > Project Settings > Physics > Gravity

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 rd42 · May 26, 2010 at 02:40 PM 0
Share

So if I want to be precise, the values I choose for AddForce () should be in newtons?

avatar image SteveFSP · May 26, 2010 at 06:22 PM 1
Share

If you need things to behave in a physically accurate way based on mass, using newtons (Force$$anonymous$$ode.Force) will do it. But that will add complexity. Applying an acceleration (Force$$anonymous$$ode.Acceleration) or a velocity change (Force$$anonymous$$ode.VelocityChange) is often an easier method of control.

avatar image stevesan · Feb 11, 2013 at 07:00 AM 0
Share

Should also note that if you compute your own forces/accelerations, it's probably a bad idea to do it in Update(), since the time step can change. Do it in FixedUpdate ins$$anonymous$$d.

avatar image
2

Answer by DallonF · May 26, 2010 at 05:19 PM

I believe I'd heard that 50 units of force translates to 1 unit of distance per second per second.

Comment
Add comment · Show 4 · 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 krubba · Feb 01, 2013 at 04:05 PM 0
Share

I ran into a similar situation where i needed to know precise units for thrust, so I ran an experiment. Earths gravity, and the Unity default, is -9.81 Newtons, and so, in order for a 1kg object to float, i.e. counteract gravity, it should require +9.81 newtons of force. However, calling AddForce(0, 9.81f, 0) doesn't cut it, your object will still fall.

Turns out DallonF was on the right track, because if you add 50 * 9.81 of thrust, your object will float. So I suppose the units for thrust are actually 1/50th of a Newton...

avatar image paullus · Apr 27, 2013 at 02:32 PM 0
Share

This might be a little late but i've found that by multiplying the gravity by the mass of the rigidbody, and object can stay floating.

avatar image hakuna1811 · Dec 16, 2013 at 03:57 PM 1
Share

Actually, this number 50 is related to the frequency of FixedUpdate, by default 50 times per second. I believe that "a continuous force" is just independce with time. It means that if we want to apply Force$$anonymous$$ode.Force, we need to call this function in 1 second, for each FixedUpdate, this force automatic reduced by 50, and in total: F/50*50 = F If we can some how change the frequency of FixedUpdate, Force$$anonymous$$ode.Force still the same in 1 second, but Force$$anonymous$$ode.Impulse will affect in longer/shotert time duration of 1 fixed frame (and because Impulse only affect in 1 frame)

avatar image nhawk · Apr 13, 2014 at 09:04 AM 0
Share

I've had different results in my tests: When using AddForce(..., Force$$anonymous$$ode.Force), I can get an object to float by using exactly 9.81f * rigidbody.mass. There does not seem to be any need to consider the Time.deltaTime when doing this in FixedUpdate. This is with Unity 4.3.4.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

2D 360 degress platformer example needed 0 Answers

How can I change friction of a Physic material in script? 1 Answer

i want a raycast to only collide with an object, and viceversa 1 Answer

Ball with bounciness 1 bounces higher and higher in unity2d,Ball jumps higher and higher when bounciness set to 1 1 Answer

RigidBody controller - Where to start? 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