• 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
0
Question by brentshermana · Aug 14, 2015 at 07:26 PM · physicsrigidbody2dphysics2drigidbody.addforce

About Rigidbody2D.AddForce's duration...

I'm making some calculations for physics based AI movements, but they rely on the functionality of RigidBody2D.AddForce.

  • Does it apply said force for the duration of the current frame? less? more?

  • Is there any more convenient way to do a specific amount of work (the technical physics-y kind: W=F*d) to an object? (that's what my calculations do, in a nutshell)

Any remotely relevant discussion is appreciated

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
1
Best Answer

Answer by NoseKills · Aug 14, 2015 at 07:48 PM

The way I remember Box2D doing it is... all AddForce and AddTorque calls increase the rigidbody's internal Vector2 linearForces and float torque respectively, and every FixedUpdate those forces get applied to the object using the Time.fixedTime for F/m = a -> v0 + (a*t) = v1 and same for torque->rotation... and the internal forces are reset back to zero.

Having said that, there's a lot of variables affecting this equation (damping, friction, floating point inaccuracy...) so I hope you don't expect scientifically accurate results

Any remotely relevant discussion is appreciated

Actually it's not THAT welcome :) sorry to say. Unity answers is meant for specific questions with specific answers and all subjective discussions should happen at Unit Forums.

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 brentshermana · Aug 14, 2015 at 08:33 PM 0
Share

Thanks for the answer, Nose$$anonymous$$ills. What I meant by that last comment is that an answer that elaborates on the concepts behind the answer and explains it fully (in my opinion, your answer does this as well ;) ) is more useful than just the answer itself.

avatar image
0
Wiki

Answer by brentshermana · Aug 18, 2015 at 12:52 PM

In addition to the information provided by NoseKills, here is some useful information that allows me to get the more predictable results I want:

"Use Impulse mode:

rigidbody.Addforce(transform.up * 10, ForceMode.Impulse);

In Impulse mode, Unity applies instantly the velocity change equivalent to the force applied during 1 second. Mass and gravity will be taken into account, thus the result is a little more complicated to predict."

source: http://answers.unity3d.com/questions/202291/rigidbody-add-force.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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

2D Physics Problem? 1 Answer

Rigidbody2d.addforce in the direction of mouse problem 1 Answer

Reset Rigidbody2D rotation after collision 2 Answers

Recalculating collisions after Physics2D.IgnoreLayerCollision()? 1 Answer

How to make physics relative to moving parent 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