Accelerometer not working correctly

Bugs will be moved here once resolved.

Post » Wed Dec 03, 2014 11:14 pm

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
You do not have the required permissions to view the files attached to this post.
B
8
S
1
Posts: 65
Reputation: 1,108

Post » Thu Dec 04, 2014 6:13 am

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.
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Thu Dec 04, 2014 2:48 pm

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.
Scirra Founder
B
397
S
236
G
88
Posts: 24,428
Reputation: 194,570

Post » Fri Dec 05, 2014 4:33 am

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

Thanks Volkiller730, how would I do that?
B
8
S
1
Posts: 65
Reputation: 1,108

Post » Fri Dec 05, 2014 5:48 pm

@dankhan - r191 is out now, could you give it a try and see if the issue is resolved?
Scirra Founder
B
397
S
236
G
88
Posts: 24,428
Reputation: 194,570

Post » Fri Dec 05, 2014 9:58 pm

Ashley wrote:@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
B
8
S
1
Posts: 65
Reputation: 1,108

Post » Fri Dec 05, 2014 11:47 pm

@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
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Sat Dec 06, 2014 2:41 pm

@dankhan - have you made measurements that identify it as exactly a factor of 10 difference?
Scirra Founder
B
397
S
236
G
88
Posts: 24,428
Reputation: 194,570

Post » Sat Dec 06, 2014 4:58 pm

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.
B
8
S
1
Posts: 65
Reputation: 1,108

Post » Tue Dec 09, 2014 6:14 pm

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?
Scirra Founder
B
397
S
236
G
88
Posts: 24,428
Reputation: 194,570

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 7 guests