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.
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.