• 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.

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

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

Smooth client-side prediction with physics seems to be impossible in Unity 1 Answer

Using kinematic rigidbody on parent for disable enable mesh collider and primitive collider children? 1 Answer

Physics.Simulate time increases exponentially relative to rigidbody count 1 Answer

How to create floating platform? 2 Answers

Excluding some physics collisions 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges