• 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 /
  • Help Room /
avatar image
0
Question by infinitesunrise · Mar 31, 2016 at 10:04 PM · vector3transform.positionairplaneaircraft

Trying to find air speed of a plane, as opposed to distance traveled

I'm putting together a sort of flight sim, and I'm trying to measure the air speed of my aircraft - The speed at w$$anonymous$$ch air flows over the wings - in order to determine the amount of lift generated. I can measure the distance the aircraft moves between frames by comparing transform.position before and after, but t$$anonymous$$s doesn't take into account t$$anonymous$$ngs like falling straight down, or potential lateral movement. See t$$anonymous$$s illustration:

alt text

The aircraft on the left is frame 1, w$$anonymous$$le the aircraft on the lower right is frame 2. I can get the distance between them easily, but that's not what I want. I want to isolate just the plane (No pun intended) that frame 1's direction.forward lies on, and (I guess?) find that component's contribution to the aircraft's motion. T$$anonymous$$s would be the slightly transparent hypothetical aircraft in the upper right, w$$anonymous$$ch I assume would be a reasonably accurate representation of air speed.

So primarily my question is: How do I do t$$anonymous$$s? And a secondary question would be, is t$$anonymous$$s what I should be doing in the first place?

plane.png (89.0 kB)
Comment
Add comment · Show 1
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 Cherno · Mar 31, 2016 at 10:58 PM 0
Share

You could jsut offset the vectors that your measure the distance of between frames so the vectors are far away from the pivot of the object. This would at least take care of lateral movement. Maybe just measure the distance for one wing tip?

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by infinitesunrise · Apr 02, 2016 at 12:52 AM

Found an answer to t$$anonymous$$s, I just needed to read more documentation. Vector3.Dot() lets you find the dot product between two vectors (1 for parallel and in alignment, 0 for perpendicular and -1 for parallel but in opposite alignment), w$$anonymous$$le Vector3.Angle() lets you find the angle between two vectors in degrees, from w$$anonymous$$ch you can then work out the component of one vector wit$$anonymous$$n the other. Dot() is a bit tricky in some circumstances what with the plane moving and all, so I'm gone the Angle() route.

My code in case anyone is interested:

         Vector3 displacementVector = transform.position - lastLocation;
         float displacement = displacementVector.magnitude / Time.deltaTime;
         airSpeed = ((90.0f - Vector3.Angle(displacementVector, transform.forward)) / 90.0f) * displacement;

I normalize it to 90 because my in-game plane is a human-powered glider, no fancy loop-the-loops or anyt$$anonymous$$ng like that.

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 phxvyper · Mar 31, 2016 at 11:07 PM

Prepare thy self, Calculus Incoming!

Provided that there is no wind speed, such that if the plane didn't exist, there would be no wind, you can determine how much force is being applied to the wings. I don't know if t$$anonymous$$s is how consumer flight simulations games do t$$anonymous$$s, but t$$anonymous$$s is how to do it with some level of accuracy.

I'm going to massively simplify the equations for Lift and air friction (as provided by NASA's documentation) due to the fact that finding a coefficient for your object is very complex and there are a lot of other equations and arithmetic involved in determining a specific coefficient for a specific object. We're going to assume that your coefficient is 1. Its up to you to change t$$anonymous$$s value until the motion of the plane feels more realistic or how ever you want it to feel.

determining lift

Your goal here is to determine the amount of Torque (Td) created around the wings. T$$anonymous$$s, along with the force caused by jet propulsion, and the force caused by the y axis of the drag (Fdy), will produce your overall Lift.

You can determine that Fdy = Fd * cos(pi)

In the equations above, C = 1, p = air density, A = cross-sectional surface area of the wing bow, and v = velocity. Also, r is equal to the length of the bow of the wing. The bow is the section of the wing that is rotated by a rotor in order to produce all of these desired results. If you haven't seen t$$anonymous$$s in action, look up some videos on plane lift.

The following equation is the final equation for determining how much torque is present .

final torque integral


In Conclusion:

Use these equations to determine how much rotation occurs. Then use the force of drag in the y-axis to determine how much lift force is caused by air friction. Finally, use the force caused by whatever source of propulsion you have to increase/decrease velocity and indirectly produce t$$anonymous$$s lift effect.

P.S.

Sorry for my pretty bad handwriting, lol.


w5dbjvt.png (169.9 kB)
ridtczt.png (22.7 kB)
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 infinitesunrise · Apr 02, 2016 at 12:50 AM 0
Share

WOW! That's an immense amount of work! Actually, it's not much more work than I'm already doing. My in-game plane already has a lift coefficient (0.45, very low but it actually works out well at that number), air density (1.225 for now) and a surface area ("3"... Heh), and I've been working out it's movement via newtonian forces so of course seeing this calculus all of a sudden comes as a shock. It sounds like this would work, but I actually found a much simpler way to get the forward component of the plane's displacement, and that is by using Vector3's Dot() and Angle() methods! That said I'm bookmarking your answer, could come in handy down the road. Thank you.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Vector3 is not receiving enough arguments from a another script that gives out transform.position. 1 Answer

Falling object respawner 1 Answer

Unity standard assets 2018.4 Aircraft Ai isn't working on my own 3d airplane model. 1 Answer

3D Pong Clone: Set position of a Rigidbody, or change how a speed vector is verified? 1 Answer

Vector3 problem 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