Use quaternion(s) to rotate the accelerator reading
I am using some code to move my player using the orientation of the phone. When the phone is face up, the player is not moving. Below is the code that I use to access the orientation.
Vector3 dir = new Vector3(Input.acceleration.x, 0, Input.acceleration.y);
How would I go about rewriting this to check the orientation of the device when the script starts, in order to allow the player to position the device in a more natural way. I would like to generate an "adjusted" acceleration Vector3
that would replace the Input.acceleration
references above.
I know that this would probably use Quaterion.FromToRotation
, but all of my attempts at working with this have failed.
Your answer
Follow this Question
Related Questions
Does Input.acceleration use gyroscope? 2 Answers
Motion based Gesture recognition using accelerometer or gyroscope 1 Answer
Roll a ball : Accelerometer calibration 0 Answers
Ignore gyroscope yaw 0 Answers
Gravity on Android 1 Answer