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
1
Question by xmediagrafx · Oct 30, 2010 at 10:26 PM · guiiphoneflight

altimeter gauge...

i have been trying to find info on how create an altimeter gauge for my flight sim. Can anyone steer me in the right direction? thanks!

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
2
Best Answer

Answer by Novodantis 1 · Oct 30, 2010 at 10:43 PM

Depends on the level of realism in your sim. A real altimeter is just a barometer, calibrated to some pressure level datum given some assumptions (otherwise known as International Standard Atmosphere, or ISA conditions). The change in air pressure results in some interesting calculations to alter indicated altitude.

Of course if you are talking about a standard combat flying game, you're basically going to just be displaying the plane's global y coordinate (assuming y=0 to be sea level). Methods of doing this vary. Outputting the number to screen, the simplest of all, is easy. Add this script to the object:

function OnGUI() {
  GUI.Label(Rect(10,10,200,20), "Altitude: "+transform.position.y);
}

That's the value you want, but I'd imagine you want to pretty it up. I'm guessing you're intending to go for the classic circular dial, which involves simply converting a numerical value to a radial one. Check out this thread on making a speedometer, the principle is essentially the same: http://answers.unity3d.com/questions/8120/how-can-i-make-an-on-screen-speedometer

Comment
Add comment · Show 4 · 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 Novodantis 1 · Oct 30, 2010 at 10:52 PM 0
Share

Oh, in Unity's default scale that's in meters. You can display the number in feet by multiplying it by 3.281.

avatar image xmediagrafx · Nov 01, 2010 at 05:59 PM 0
Share

to trouble you once more :) how could this be modified to make a sound (alarm) when height goes under a certain number? kind of like a real plane alerts you when drop altitude?

avatar image Novodantis 1 · Nov 02, 2010 at 05:03 PM 0
Share

You would simply need to check when that y coord drops below a certain number, and if so to enable a looping alarm sound. You will also want a boolean to keep track of the fact the alarm is already on, so you aren't starting the alarm sound every frame or such. Eg: var alarmSounding : boolean = false; Then your condition would be something like: if (yCoord < dangerZone && !alarmsounding) {....

avatar image Novodantis 1 · Nov 02, 2010 at 05:05 PM 0
Share

Just be sure to set alarmSounding to true when you activate it, and keep the reference to the sound so you can turn it off with a similar, reverse condition

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

No one has followed this question yet.

Related Questions

How to change time Splash Screen is Displayed 3 Answers

iPhone GUI Text asks for edit on touch 0 Answers

Button does not work when another is active? iPhone 5 Answers

PlayerPrefs aren't working in iphone 2 Answers

Play streaming video. Unity for Iphone 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