• 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 EvilSquid · Aug 16, 2013 at 04:24 PM · c#forceaircraftlift

Creating lift under the wings of an aircraft?

Okay, so from my previous question I have now succeeded in adding a force to push the aircraft forward (the engine).

However, I now need to simulate the lift created underneath the wings of the aircraft, to increase the altitude of the aircraft! I've done my research blah blah and I've established that when my aircraft reaches a speed of 100 m/s, it will begin to lift off the ground but no matter what I do, I can't get it to work!

I'm using:

 public int TakeOffSpeed = 100; //Speed at which the aircraft lifts
 
     void Start ()
     {
         
     }
     
     void FixedUpdate () 
     {
         if(Input.GetButton ("Throttle")) //Throttle is increased using 'W' key.
             rigidbody.AddRelativeForce(0,0,-50);
     
         
         if(rigidbody.velocity.magnitude.Equals(TakeOffSpeed))
             rigidbody.AddRelativeForce (0,200,0); //Force pushing upwards

I'm not sure why it's not working. I've tried different values but still nothing.

Thanks

Comment
Add comment · Show 3
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 zombience · Aug 16, 2013 at 04:29 PM 0
Share

perhaps try a different force method?

rigidbody.AddForce(0, 200, 0, Force$$anonymous$$ode.Acceleration);

avatar image EvilSquid · Aug 16, 2013 at 04:47 PM 0
Share

I've tried that but still nothing... Thanks anyway :)

avatar image EvilSquid · Aug 16, 2013 at 05:05 PM 0
Share

No, wait, it's working now! Thanks zombience! :D

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Aug 16, 2013 at 06:21 PM

The chance that the magnitude of the velocity will exactly equal 100 if very small. How you want to handle the issue will depend on your game mechanic. As a starting point, rewrite to:

    if(rigidbody.velocity.magnitude >= TakeOffSpeed)

You will have to reduce the amount of force being applied since this logic will add some force every frame the magnitude is above TakeOffSpeed.

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
avatar image
0

Answer by ZeroSumGames · Aug 16, 2013 at 06:37 PM

If your airplane is accelerating, then this line will only be called a single time, in passing:

if(rigidbody.velocity.magnitude.Equals(TakeOffSpeed)) rigidbody.AddRelativeForce (0,200,0); //Force pushing upwards

What you are looking for is lift that applies any time the airplane is ABOVE the takeoffspeed.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

18 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How would you make an object behave like a magnet? 1 Answer

Force isn't using local coordinates! 1 Answer

How can I increase the amount of force over time? 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