Mobile Game Orientation

Is there any way to query in code or blueprint a device’s orientation even if the game doesn’t enable it? I have a 2d game that is ONLY portrait, however I would still like to capture when the user rotates the device to landscape so I can manually adjust a portion of the UI elements to the new orientation (not the entire viewport/game)?

I’m asking this because I’ve already looked into trying to figure it out on my own using the Tilt and GetTilt blueprint nodes. It has been very frustrating and still haven’t had any luck. I posted it in another thread without any answers:

Thanks,

i try to rotate the the camera accordingly to the orientation of the device.

by using the gravity value of the motion input, i get half acceptable results: holding and turning the tablet like a steering wheel works fine cause the background seems to stand in real-space. you could use the yaw angle to figure out if the device is hold in landscape or portrait.

the trouble is when laying the tablet flat on the ground. the camera flips around cause the “tablet can’t decide, which one is the upper edge”. to solve this, i think a fixed point in real space is needed (like a magnetometer, or maybe set such a fixed point on start and accumulate it with or rotation rate??)

In your, take a look at the roll value: its 0 when the device is horizontal screen up, and -180 screen down. cutoff the yaw-check by this value to avoid the flipping, and maybe adjust the ui for “flat-orientation” instead.