Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411493 Posts in 69371 Topics- by 58428 Members - Latest Member: shelton786

April 25, 2024, 04:33:55 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Unity: Phone vertical height above ground
Pages: [1]
Print
Author Topic: Unity: Phone vertical height above ground  (Read 635 times)
Ryan Taylor
Level 0
**



View Profile
« on: August 09, 2017, 03:57:41 AM »

I'm looking to get the users (person in the real world) height above ground.

Example: I'm on the ground therefore my height is 0. I walk up the stairs and my height steadily increases.

Is there an effective way of accomplishing this? I've read about using acceleration, but it's way too shakey and no where near accurate. In addition, it appears you cannot capture vertical non-angled acceleration
Logged

Games Released:
* debris



Thank you,

Ryan Taylor
Game Developer
Seobits
TIGBaby
*



View Profile
« Reply #1 on: August 14, 2017, 01:19:26 PM »

You can use the pressure sensor, it's accurate most of the times but result may vary with weather changes and sometimes this might not be included in some low end devices.

https://developer.android.com/reference/android/hardware/SensorManager.html#getAltitude%28float,%20float%29

As an alternative you might want use the GPS to get the user altitude, if you are looking for changes in altude lower than 10m, this method might be inaccurate, specially for cheap devices.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic