Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
This question was closed Oct 31, 2017 at 06:32 AM by geganadiradze for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by geganadiradze · Oct 30, 2017 at 07:54 PM · rigidbody2dvelocityphysics2daccelerationforces

Objects displacement after applying force doesn't match calculations

Hello, I'm trying to test just a simple setting using AddForce and I have difference between results from unity and results from math equation, Couldn't find out what's wrong any tips would be appreciated... m = 1; gravity and drag are turned off. Starting position is (0; 0) Objects final position becomes (202; 0). However with my calculations I should get (200; 0). Since F=ma, (F = 100, m = 1) => a = 100. S = 1/2 a t2 (t = 0.02 * 100, since deltatime for fixed update is 0.02 and I add force 100 times) so I get S = 200, But unity says 202, I get similar results In case I use impulse force mode. What do I miss?

 int count = 0;
 float x = 100;
 float y = 0;
 
 Vector2 force;
 Rigidbody2D rb2d;
 
 void Start ()
 {
     rb2d = GetComponent<Rigidbody2D>();
 
     force = new Vector2(x, y);
 }
 
 void FixedUpdate()
 {
     if (count < 100)
     {
         rb2d.AddForce(force);
     }
     else
     {
         rb2d.velocity = Vector2.zero;
         rb2d.angularVelocity = 0;
     }
 
     count++;
 }

If I set x = 10 final position is (2,2 ; 0). If I set x = 1, than - (0.04 ; 0). Neither of these match my calculations.

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

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by pako · Oct 30, 2017 at 08:33 PM

The Physics simulation is an approximation. In your example you are using the 2D Physics engine, but there's a very good explanation of the approximations in the 3D Engine PhysX manual . Check out the Physics vs. PhysX section:

http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/3.3.4/Manual/Introduction.html#physics-vs-physx

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

Follow this Question

Answers Answers and Comments

75 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 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

Adding a force to RigidBody2d - Velocity returns 0 1 Answer

Slow a rigidbody to a stop over a set distance? 1 Answer

2D rigidbody velocity relative to rotation? 0 Answers

How can I get 2 rigidbody2d objects to "share" physics? 1 Answer

How to get acceleration in a top-down angle 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