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 /
avatar image
0
Question by cheesydongboys · Nov 15, 2017 at 12:46 AM · rigidbodyphysx

Simple rigid body free fall results in correct velocity but not distance?

Hi all,

I am having a pretty basic issue that I hope is just a simple mistake on my part. When letting a simple 1m^3 rigidbody block fall, I am finding that the block is not displacing quite fast enough. I am logging the distance from the objects start point, velocity, and corresponding time to the console for every fixed update via script. The logged velocity agrees to three or four decimal places to what you would predict using the classic v2 = v1 + at equation, but the expected distance for that velocity and time are off what you would predict using d = v1 + 1/2 x a x t^2. In this case for example with gravity at -9.81 m/s^2, the velocity at t = 1.7s is 16.67699 m/s and the distance is 14.25883 m. Using the classic kinematic equations you would expect a velocity of 16.677, but a displacement of 14.17545 m. I have no drag applied to the object, so I am curious as to why this value is off about 8 cm over just 1.7 s of free fall. The velocities agree fine, so does this mean Unity is not using the traditional kinematic equation for displacement of an accelerating object?

Any help on this would be much 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

Answer by Bunny83 · May 20, 2020 at 06:14 PM

Well since the question got bumped already I'll post an answer. I've explained this already in my answer over here in detail. However to sum up what is happening I will go a bit more in detail.


First of all you have to understand that all our calculations happen at discrete time intervals unlike reality which essentially performs continuous integration. So every variable involved will only change at discrete timesteps. We generally use Time.deltaTime to fix for variable timesteps. However we can only fix linear equations that way. For a quadratic or more complex relationship this doesn't really work very well. The error gets smaller the higher the framerate gets.


As I explained in my other answer since the delta velocity is a linear change over time we can simply use deltaTime to move from a frame based to a time based relationship. The pure position change is also a linear relationship. Each second we add "velocity" to the position to get the new position. However when we change the velocity as we're moving it's no longer a linear relationship. Linear means we just assume that the value is essentially the same over that time period and we just linearly scale it depending on the time passed.


Using the "right" formula for a constant accelerated movement wouldn't make much sense for a rigidbody simulation since the acceleration and forces you usually work with are by no means constant. Yes, gravity is but once you reach the ground you are stopped by the ground.

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 HaiYangLiu · May 21, 2020 at 03:30 AM 0
Share

Thank you very much for your answer, it has benefited me a lot.

avatar image
0

Answer by HaiYangLiu · May 20, 2020 at 12:59 PM

Hello! Have you solved your problem? I asked Unity but did not get useful information. https://forum.unity.com/threads/a-problem-when-using-physics2d-simulated-freefall-movement.894283/#post-5874697

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

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

A Rigidbody sits on a plane, rotation controlled by a script. 1 Answer

How to "discharge" the angular power of a configurable joint? 0 Answers

Ways to work around OnCollisionStay/Enter events firing one frame late? 2 Answers

Basic questions about Unity and RigidBodies 1 Answer

Measure Rigidbody deceleration 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