Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 sbob322 · Oct 07, 2015 at 07:30 PM · locationgpsaltitude

Device altitude change not accurate

I am working on a project that currently gets accurate position changes by taking the gps coordinates and using the haversine formula to track the devices movement. We also want the device to get the altitude change while the player moves. Location has an altitude that I am recording the highest and lowest points seen and just taking highest minus lowest to find the total altitude change but I get very large readings just walking across my house. These numbers are about 100 or higher typically.

private float highest; private float lowest;

//each time I get the current location info I record this.

if(Input.location.lastData.altitude > highest) { highest = Input.location.lastData.altitude; } if(Input.location.lastData.altitude < lowest) { lowest = Input.location.lastData.altitude; }

//At the end of the walk I just resolve it like this.

float heightDistance = highest - lowest;

Comment
Add comment · Show 6
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 Dave-Carlile · Oct 07, 2015 at 07:30 PM 0
Share

What's the question?

avatar image sbob322 · Oct 07, 2015 at 07:32 PM 0
Share

Sorry thought that was clear $$anonymous$$y question is does anyone know of a way to get accurate altitude changes or what is wrong with the way I am doing this.

avatar image Dave-Carlile · Oct 07, 2015 at 07:37 PM 0
Share

I assume you're doing the various things mentioned in the documentation to make sure location services have started, etc...?

If you modify their example so it loops and logs out the altitude does it give you the same varying results or are they more stable? That would deter$$anonymous$$e whether it's something in your code or something with the GPS itself.

avatar image sbob322 · Oct 07, 2015 at 07:41 PM 0
Share

Yea I have the location service started and have tried multiple low numbers for the accuracy (10, 5, 1). I currently use it for horizontal travel at it is accurate for that its just my altitude that is way off. The code I listed above is all I use for altitude since it just seems to be a number for the current altitude.

avatar image Dave-Carlile · Oct 07, 2015 at 07:47 PM 0
Share

Can you use the code from the example? Log the values as you walk around, then eyeball them to see if they have the same wide variation as your code is showing. That will show if there's a problem in your code or not.

It could be that you're just occasionally getting a large value but most of the samples are accurate. But you can't tell that with your current code. By logging a bunch of values you can get a better idea what the data looks like.

If it ends up being just the occasional sample that's off then you can do some kind of filtering on the data.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

GPS doesn't work in AGPS mode 0 Answers

Location Service on iOS 1 Answer

Get Android devices current country location 0 Answers

How to import GPS location coordinates from Android device? 4 Answers

How to pass accurate GPS location from android studio to unity? 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