[Bug] Android Accelerometer giving wrong values when game launched in portrait mode

I was working with the accelerometer in my game and my game was running in the portrait mode, and UE4 was always returning constant value .

Then I went into deep and found that UE4 was returning right values but it was according to the landscape mode,but I needed values as per portrait mode.

I myself tried to fix this issue by modifying the UE4 code but I couldn’t find the core input modules,so I thought that its better if I report this bug.

How to produce this issue?

  1. Create any template game and set its orientation as portrait mode.
  2. Then in the character BP file create a node of Tilt Event and print these values and observe it. Try to tilt the phone once in portrait mode and then in landscape mode you will observe the difference.

If you can can guide me proper direction I can myself fix this issue by modifying the UE4 code.

AnuraX,

Could you please provide screenshots or a video of what you’re experiencing? I do not see any problem with the tilt values when I set up a project, perhaps I am overlooking what you are seeing. I did check and there are no reports of this currently.

Thank you!

Ok so below I m providing the screenshots from my game.

Carefully observe X and Z values in all cases.

Case 1.
Left Tilt in portrait mode(i m holding phone in portrait mode).

Case 2
Right Tilt in portrait mode(i m holding phone in portrait mode).

Case 3
Left tilt in landscape mode(I m holding phone in landscape mode).

Case 4
Right tilt in landscape mode(I m holding phone in landscape mode).

Conclusion

After observing the above screenshots you will come to know that in portrait mode however you tilt the X value is always -2.

But when in hold my phone in landscape mode I am getting positive and negative values for X as expected from below image.

106321-xyz.jpg

Below I have provided screenshots.

AnuraX,

This issue (UE-6135) has been fixed in 4.13. Please either upgrade your engine, or you can change the LaunchAndroid.cpp file from 4.13 and add it into your 4.12 Engine files to correct the issue. Thank you for explaining the issue further.

Have a great weekend! :slight_smile:

Hey,
I’ve been having the same problem for a while, I see on version 4.25 that I have the same problem as you, I deduce that you have to do a personal manipulation when you switch to portrait mode, Could you tell me how you solved this problem please?
(Sorry about my English)