-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gyroscope input issues #160
Comments
Well, the code in GyroscopeListener is based on the documentation, so I think it's correct. But I may be wrong, of course! Unfortunately, I haven't got a shader at hand to test whether this correct or not at the moment. But since this open source, you may of course play around with it and see if you can make it work for your sample 😉
I think inversing isn't required because:
|
Looking at the comment in the example code:
Here's how I understand it: If the |
I made a shader to explore the different orientation vectors: https://gist.github.com/planiitis/d940919503d442f0c7287ae10f74b466 Set Sensor Delay to Game or UI for best results. The shader provides a view of the
Current code negates the |
The current
vec3 gyroscope
uniform provides incomplete gyroscope data, as it reduces the 3DOF gyroscope data into a 2DOF constant-length vector.Furthermore, I have trouble interpreting the data. As I understand it, the current gyroscope uniform starts as a vector at [1.0, 1.0, 1.0]. This vector then continuously gets rotated according to gyroscope input. The vector appears to be relative to the device's frame of reference, as by my observations, rotating the device around a single particular sensor axis results in the vector being rotated correspondingly around that particular axis. I haven't been able to make much sense of it beyond that. In particular, I've tried to interpret the
gyroscope
vector as being in the same frame of reference asgravity
,linear
andmagnetic
, but no matter how I try to flip and rotate it, it doesn't fit with the rest of the vectors.I'm no geometer, but could it be that something is backwards in GyroscopeListener.java? Something tells me either the rotation angles should all be negated, or the vector should rather be multiplied by the inverse of
deltaRotationMatrix
there in order to make sense.Possibly, if
GyroscopeListener.rotation
were a rotation matrix rather than a vector, the data might make sense, and if provided as a uniform similar torotationMatrix
, could be used to create vectors that appear to be in the same frame of reference asgravity
andmagnetic
. I understand the following to apply to the existingrotationMatrix
uniform and would expect it to apply fordeltaRotationMatrix
, and by extension, any matrix rotated bydeltaRotationMatrix
as well:Additionally, often one might only care about the angular speed of device rotation. Then a uniform providing either direct access to the gyroscope data or to
deltaRotationMatrix
would make sense.The text was updated successfully, but these errors were encountered: