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 anwe · Dec 28, 2011 at 09:38 AM · dragmomentumairplaneaerodynamics

How to cancel aerodynamic drag?

I have an airplane with my script, the main problem is that I use those 2 formulas :

    L = (p*Mathf.Pow(transform.InverseTransformDirection(rigidbody.velocity).z*3.6,2)*A*Cl)/2;

for the lift and

 Dx = (p*Mathf.Pow(transform.InverseTransformDirection(rigidbody.velocity).x*3.6,2)*A*Cd)/2;

 rigidbody.AddRelativeForce(-Vector3.right*Dx);

 Dy = (p*Mathf.Pow(transform.InverseTransformDirection(rigidbody.velocity).y*3.6,2)*A*Cd)/2;

 rigidbody.AddRelativeForce(-Vector3.up*Dy);

 Dz = (p*Mathf.Pow(transform.InverseTransformDirection(rigidbody.velocity).z*3.6, 2)*A*Cd)/2;
 
 rigidbody.AddRelativeForce(-Vector3.forward*Dz);

for the drag. I set the drag of my rigidbody to 0.1 and try to use those formulas, but airplane continues moving with momentum/inertia

No idea? :D

Comment
Add comment · Show 4
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 TowerOfBricks · Dec 28, 2011 at 03:31 PM 0
Share

Well, canceling the drag is simply to set "drag" to 0 (zero). But I guess that's not what the problem really is? You want to cancel the first law of physics, the one about momentum?

avatar image anwe · Dec 28, 2011 at 05:36 PM 0
Share

yes, here we are, cause I add the force to my airplane, but when I use addrelativetorque it continues to go straight forward, even if it's rotated

avatar image TowerOfBricks · Dec 28, 2011 at 05:39 PM 0
Share

Ah, well, torque doesn't affect movement unless there is a collision. You could try setting rigidbody.velocity to transform.forward * someSpeed to get it to always move in the forward direction.

avatar image anwe · Dec 29, 2011 at 09:26 AM 0
Share

yes, u'r right, the problem is that it conserves its momentum, that's the matter

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by zero3growlithe · Dec 29, 2011 at 10:07 AM

Hmmm, i have anti-grav ship which had this annoying momentum too, so i did something like this:

 var MaxSpeed : float = 1700000;
 var ActSpeed : float = 0;
 
 function FixedUpdate() {
     verMovement = Input.GetAxis("Vertical");
     rigidbody.AddForce(transform.forward * ActSpeed * Time.deltaTime);
         if (verMovement && ActSpeed < MaxSpeed) {
             ActSpeed += 2500;
         }
         else if (!verMovement && ActSpeed >= 1500){
         ActSpeed -= 1500;
         }
         if (ActSpeed < 0){
             ActSpeed = 0;
         }
 }
 function OnCollisionEnter (StrHit : Collision){
     rVelocity = rigidbody.velocity.magnitude * 3.6;
     if (StrHit && ActSpeed > 0 && StrHit !== gameObject.tag == "Enemy"){
         ActSpeed -= 900 * rVelocity;
     }
 }
 function OnCollisionStay (WeakHit : Collision){
     rVelocity2 = rigidbody.velocity.magnitude * 1.6;
     if (WeakHit && ActSpeed > 0){
     ActSpeed -= 200 * rVelocity2;
     }
 }

Hope it helps... somehow ^^d (rigidbody is 60u heavy, and is set to drag = 3)

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Limit object rotation on drag it 0 Answers

Banking and momentum 1 Answer

Drag camera with two finger swipe 1 Answer

How to import the object from server to unity 2 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