- Home /
Accelerometor/Gyroscope position tracking?
Hello.
I have a technical problem I need to solve. It is basically creating a system motion gesture tracking and recognition using an iOS device. The expected use is very much like a wiimote. I don't really have an idea on how the wiimote actually tracks and recognizes the motion but from what I observed on Unity's accelerometer and gyroscope API is that they only track the device's orientation.
My problem is, I want to know the positioning of the device also to track the panning. So for example, without changing the orientation of the device, it is moved around. I want to know the direction it is moved around. Is this possible with the provided API?
From my experiments, Input.acceleration and Input.gyroscope.gravity produce the same values and does not mean the direction (panning) applied on the device. How do I go about this? Or is the wii just similar? Is it all about orientation tracking and we are just led to believe that we are tracking position but it is really not?
Thank you.
Answer by LT23Live · Aug 27, 2016 at 07:16 PM
If you want the direction the device is facing try using the compass. Code snippet below: Click this link for more info. https://docs.unity3d.com/ScriptReference/Compass-magneticHeading.html
Input.compass.enabled = true;
transform.rotation = Quaternion.Euler(0, -Input.compass.magneticHeading, 0);
Your answer
Follow this Question
Related Questions
How do I access CoreMotion and the Android equivalent? 0 Answers
How to judge intensity of shaking in android phones 1 Answer
Changing origin of cooridinates to decieve gyroscope in ARCore 0 Answers
Using custom accelerometer, gyro & magnetometer to move objects 1 Answer
gyro.attitude lags on Samsung Galaxy S2 0 Answers