Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Golan2781 · Jan 27, 2013 at 09:52 PM · physicsdragkinematicphysx

Calculating flight time with starting velocity and drag

Hi! I'm currently working on auto-aim and AI functions that must "guess" where an object will be by the time a projectile could reach it. While weapon spread proved enough when dealing with fast projectiles, once I tried our code with slow moving, high drag projectiles, it was no longer accurate enough.

So, I need to understand how Unity uses the Rigidbody drag attribute in its calculations but I haven't found anything. The projectile is launched with a set velocity, so in order to calculate the distance it can travel I need something like this:

 r(t) = v0*t - ∫∫ aDrag dt²

But I can't figure out what term accurately describes drag deceleration as used in Unity. Is it something akin to these?

 aDrag = drag * abs(v)
 aDrag = drag * v * v
 aDrag = Mathf.Pow(v,drag)
 aDrag = v * Mathf.Exp(drag)

I'd be really happy if someone already figured this out and could tell me. Thanks in advance.

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

· Add your reply
  • Sort: 
avatar image
0

Answer by Big Boy · Mar 03, 2013 at 09:05 PM

Hi! I am currently facing the same problem, so I logged time and position of an object with rigidbody. Then I made a fit to the resulting curves. The equation, I figured out, is

 s(t) = (1 - exp(-a * t)) * b

The main problem, I am still facing, is the determination of the factors a and b. As far as I can tell, the first equation to determinate the these factors is

 a²*b = drag * velocity .

The second equation only works, with an error usually smaller than 1%, as long as the drag is smaller than 0.2 * velocity. It is

 a = 100 * drag / (100 - drag) .

If the drag is larger, the way, that is calculated by the equation above, differs considerably. This correlation was figured out by guessing, based on the numbers, I had with my fits.


The math/physics behind the equation to describe the covered distance: the determinant differential equation is

 d²s / dt² = -a * ds / dt

meaning that, the deceleration is proportional to the momentary velocity by the factor of -a. The factor b describes the covered distance for t towards infinity.

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

10 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

Related Questions

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

Moving a regular Unity primitive and PhysX performance 0 Answers

Question on Negating Physics Drag 1 Answer

Help improving performance with 40-80 rigid bodies. 1 Answer

Projectile collides, freezes, but flips to weird angle. Help! 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