Android Question VR-angles without ORIENTATION

MasterGy

Member
Licensed User
The last few days have been very difficult. I want to make the game VR-like. The phone shows where you turn the phone. I used the 'orientation' function, which was inaccurate. I naively thought that it would be good on a more 'serious' phone. Then I bought a 'serious' phone and it didn't do anything at all.
It may be obvious to many, but it took me a long time to understand it.
ACCELEROMETER, MAGNETIC, GYROSCOPE, these are real, real, physical sensors. And ORIENTATION is an API function that calculates the orientation of the phone from the data of the previous sensors. So it does not physically exist, there is no such thing as an 'orientation sensor'. Newer Android phones no longer have the orientation function in the API. For those who use this in their program, it will not work on newer phones. So I solved it myself mathematically. Fortunately, I found a lot of documentation. Determining the 'pitch' and 'roll' angles was no problem, but the 'yaw' did not want to work at all. The yaw crawled with every move. Finally, after much thought, I managed to understand and use the rotations correctly. !

I don't want to multiply the word. In the attached program, you can see the bottom line while running! Bottom line: pitch, roll, yaw

If you have a gyroscope on your phone and your magneto sensor is accurate, it will show the 'yaw' value perfectly no matter how you hold the phone. I think this is an important thing if we want to build a vr-like game.
The code is short, can be quickly deciphered, and the essence can be extracted from it. Recommend the one you use instead of ORIENTATION!

The orientation of the phone depends on which will be the compass, roll and pitch.

These values are perfect for rotating a 3D space on your phone.

My question is, how does it work on your phones?
All answers and feedback are very helpful.
 

Attachments

  • sensorX.zip
    10.5 KB · Views: 98

Brian Dean

Well-Known Member
Licensed User
Longtime User
I have downloaded your app and have tried it on an old Pixel with Android 10. Hard to comment on what I see because I don't know what I should expect, but here is my best shot.

Accelerometer : I can detect the X-Y-Z sensors, but they seem relatively insensitive to motion.

Orientation : Work well - scale appears to be roughly 12 or 13 revolutions of the indicator for 90 degree change in the device.

Magnetic : Jitter when 'phone is stationary. Response to earth's magnetic field appears repeatable in all planes.

Gyroscope : Minimal movement - not sure how to excite the different axes.

Combination : Steady indication in all three axes, but scaling appears to be off - 360 degree rotation of the device produces less than 360 degrees motion on the indicator. Maybe that is intentional.

I hope this is what you wanted.
 
Upvote 0
Top