- Home /
Does Input.gyro.attitude (always) use compass?
As far as I could find, and what a comparison test seems to confirm, "Input.gyro.attitude" simply passes the raw Android TYPE_ROTATION_VECTOR SensorEvent value when using Android. This SensorEvent value, which is classified as using a 'virtual sensor', is supposed to use a combination of the accelerator, gyrometer and magnetometer, depending on what is available on the device.
Does Unity's Input.gyro.attitude also use the magnetometer if Input.compass does not get enabled in the code? Because the gyroscope and the compass obviously need to be enabled seperately, but the 'fused' data gets returned through the gyroscope object only. Does Unity automatically enable the compass when retrieving the attitude data?
EDIT: I just realized that in raw Android code the sensors don't have to be enabled in the same way as Unity handles enabling. So if TYPE_ROTATION_VECTOR is actually used, as I suspect, then there is probably no way to disable the magnetometer, which would mean the magnetometer is always used in Input.gyro.attitude?
I know this post is 2+ years old, but I would very much like to know this also, it is kinda hard to get this information from the documentation.
Unfortunately I have not found or received an actual answer to this question. However, during further experimentations my observations still seemed to hold (that the magnetometer is always used in Input.gyro.attitude when available on the device). For my purposes it was safe to assume so based on my observations, but this may of yours not apply to you.
Answer by anaeronbaggins · May 07, 2018 at 08:15 AM
I do believe that input.gyro.attitude uses a compass or a magnetometer. Since my android phone does not have a compass or a magnetometer, I am unable to get the output for Input.gyro.attitude.
You sure that is the reason? First of have you built it and not just run in unity remote? I also assume you had gyro enabled?
Your answer
Follow this Question
Related Questions
How to setup android build so that users without gyroscope do not see it in Play Store ? 1 Answer
I would like to know if with a unity free is possible to use gyroscope android? 1 Answer
Problem with Gyro in Unity Android project 1 Answer
Is there no simple way to get a device heading in Android with Unity? 2 Answers
Read Phone Info From Editor? 0 Answers