Question by
amiunity1 · Jul 26, 2016 at 01:46 PM ·
androidgravityaccelerometer
Precise Gravity Based on Accelerometer
I currently have the following code:
Physics.gravity = new Vector3(Input.acceleration.x, Input.acceleration.z, Input.acceleration.y) * 9.8f;
The gravity does update OK in many cases, but for example if I hold the phone face down then the gravity doesn't point to the correct direction.
How can I update the code to have the correct gravity no matter which direction the android is facing in?
Comment
Your answer
Follow this Question
Related Questions
Gravity on Android 1 Answer
Getting linear acceleration not using gyroscope on Android 2 Answers
Rolling Character Accelerometer Controls 0 Answers
Accelerometer Input Rotation Help 0 Answers