I’ve spent like 6h looking for a way to get Gyroscope data on an Android device, but looks like UE Input Motion implementation doesn’t provide the Y axis information. It gives the Rotation Rate which uses Gyroscope, but that’s not the data that I can use. Why doesn’t it provide the current Gyroscope state?
So if Epic doesn’t provide this data I should be able to get it through Java code as I did it in an AIR application using Native Extension. The problem is I have no idea what to write in Android Java, how to pack it, where to put it and what to write in UE C++, and I can’t find any introduction in the net. Please help.
If I understand correctly, the motion sensors on phones only detect acceleration. Whenever you get data for rotation on iOS using the built in rotation sensor polling, for example, it’s abstracted from you that the device is actually computing it from a combination of rotation rate and gravity. And I think the gyroscope does something extra to help clean up the rotation input.
Just last week I actually was able to get the current device rotation using rotation rate. I think I’m not quite done yet since I’m not taking gravity into account and I get some unexpected results if I rotate the device around just right. Also, I get some unwanted rotation even when the device is sitting flat on my table. Hopefully taking gravity into account will help eliminate that as well. I can post the code I have tonight when I get home.
It would definitely be nice to get just the derived device rotation instead of having to get it manually.
Thanks for the reply. What I understand is that you are trying to say that there is no straight forward way to get current device yaw rotation. I don’t get it. Mobile devices have gyroscopes and magnetometers. It’s easy to get magnetic north direction in Java or iOS, but I can’t do it in UE4? Why?
I don’t really understand how gravity can help in getting the yaw rotation.