Accelerometer not working correctly

0 favourites
  • 12 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Problem Description

    The accelerometer works in opposite way, tilting phone left moves object right, etc. This wasn't a problem before.

    Attach a Capx

    Attached

    Description of Capx

    It's a simple capx with just two events. The orientation events are used to move sprite left and right by tilting the phone.

    Steps to Reproduce Bug

    • Step 1 - Export to crosswalk android
    • Step 2 - Build with Intel XDK, full screen mode and landscape mode.
    • Step 3 - Test on phone by tilting device left and right to move sprite left or right.

    Observed Result

    When tilting device left, sprite moves right and vice versa. This didn't happen when I used C2 last year for my project. I had this tested on some other devices and out of three, one of them worked correctly. My device is Motorola Moto G.

    Expected Result

    When tilting device left, sprite should move left and vice versa.

    Affected Browsers

      Not a browser issue.

    Operating System and Service Pack

    Windows 8.1

    Construct 2 Version ID

    Construct 2 stable release 190

  • its a problem with how phones report their movement. they all do it differently the only way to fix is have your game have a calibrator.

  • I don't have a Moto G to test here, but I noticed in the code in some cases it could have flipped the value of beta (if Cordova is returning a value and the browser doesn't support it). I can't verify this fixes it, but please test r191 when it's out and let me know if it's corrected.

  • Thanks Ashley, will test it on r191, when will that be out?

    Thanks Volkiller730, how would I do that?

  • dankhan - r191 is out now, could you give it a try and see if the issue is resolved?

  • dankhan - r191 is out now, could you give it a try and see if the issue is resolved?

    Hey thanks Ashley, it seems to be working now. However, I now need to increase the value of orientation before tilt is detected. Before I had it set to like:

    Beta Orientation > 4 - Do action

    Beta Orientation < -4 - Do action

    Now I had to increase it by 10 times for the same effect otherwise it's too sensitive.

    Beta Orientation > 40 - Do action

    Beta Orientation <-40 - Do action

    I'm ok with increasing this value but I wonder if the result would be different for different phones. Maybe on some phones the old value '>4' is still appropriate.

    Thanks,

    Dan

  • dankhan because i was having these issues with some devices what i did was set up a button in my game settings users can press if they what to calibrate tilt when they press it I then tell user to tilt in direction and I check the beta and other sensors and with a global variable i set if it should change the how tilt works. most users dont have to do this as it works correctly, but for the one that do it helps most of the time. hope that helps I tryed to explain it the best I can

  • dankhan - have you made measurements that identify it as exactly a factor of 10 difference?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks Volkiller730, sounds like it's pretty complicated to do haha!

    Ashley, I haven't actually measured it but before the value was set to 4 and -4 and now by multiplying those values by 10 gives the desired result for me. Not sure if multiplying by 10 would work for higher or lower values though.

  • As far as I can tell by looking up specs, the Moto G does not actually have a hardware orientation sensor. In the C2 engine, it looks like it by accident forwards the accelerometer value to that parameter if it is not supported by hardware. Does the Moto G work with other apps that need orientation?

  • Hi Ashley, yes it's always worked. It worked with my game previously as well. And now after the C2 update it works but as I said I need to increase the orientation values otherwise the movement is too sensitive. By orientation sensor you do mean the tilt sensor on my Moto G phone right? If so that definitely works.

  • This sounds related to this Chromium bug which also specifically mentions the Moto G: https://code.google.com/p/chromium/issues/detail?id=347507

    The Moto G lacks a hardware gyroscope, but it looks like they implemented a workaround using the other sensors on the device to determine the tilt. This should fix the problem when Crosswalk gets updated to the Chrome version that has the fix (which I think is v38 or v39). Hopefully it's just a matter of waiting for that.

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)