Tilt not working as expected on Chrome Book

I found out your new file does not work correct , when I tilt my chromebook for example

goes always to the left top, never to the right side..

and portrait version

game I made with it

The example works for me on iPad. Does it work for you on your Android? My Samsung tablet is old and does not support it.

Maybe Chrome Books have different values.

You example https://zimjs.com/zapp/E_594U5 works well too - but you need to multiply your values by -1 they are reverse of what they should be. And your arrow is not doing a compass but points in movement direction.

Anyway - let's try and debug what is happening with our basic example. It should have the deviceorientation event if your devicemotion event is working.

image

Can you test this file and see what numbers you get? https://zimjs.com/zapp/Z_9MQNN

this is what I see

That is good. Do they ever change as you tilt?

yes they do move

problem tilt on chromebook
https://i.imgur.com/2GK5sTi.mp4

That looks good. Do you get how tilt works? I think you may just be used to it in the reverse. As you tilt the left side down the ball goes to the left. If you tilt the top down, the ball goes to the top. Like a ball is on the surface of the tablet.

thats the problem , it acts wrong .. and I almost never get it to the right side
.. maybe there is an explaination for it, but in landscape mode it does not work correctly , so I need to turn screen always?

yes I tried but it acts visa-versa, when I tilt down the ball should fall down, but goes up..

check this movie https://i.imgur.com/C3rSrAB.mp4

I can't see how you are tilting in the video. Okay - so maybe the axes are switched around or something. Here is a test file with just horizontal.

I have adjusted the test file to only have the horizontal tilt so tilt the left side down - what number do you see and then tilt the right side down, what number?

it must feel like gravity, tilting down ball goes down, is that working on ipad..
I do the new test

1 Like

I did the test

tilting backwards high numbers
tilting down negative numbers

You should see negative numbers (up to -90) as you tilt left and positive numbers (up to 90) as you tilt right.

You are supposed to tilt left and right for this test. So do the numbers seem to change for you tilting forwards and backwards rather than left to right? If so, then yes, the axes are switched.

ok yes (it depends how you look to a big screen)
the numbers word when in readable textposition a turn left and right I get 90 en -90 almost -87 mostly
https://i.imgur.com/6Gi9m1t.mp4

Okay - so that is tilting the keyboard side of your laptop - left and right. That looks good. Then if you tilt your keyboard up and down, the ball should go up and down. I just changed the example to do only vertical tilt - so up and down. It should have a green background. Check to see if the numbers go negative as you tilt forward away from you and positive as you tilt back towards you so the keyboard faces you.

I did going up is -90
https://i.imgur.com/7fEHsDb.mp4

So that looks good. Now try with the ball example https://zimjs.com/zapp/Z_Q5UYS when you tilt left it should go left. Tilt the keyboard back away from you and it should go up. Down towards you and it should go down. It may be odd because the screen is usually perpendicular to the keyboard. I think the sensor is in the keyboard side, not the screen side.

I tried last example but not feels correct, sorry for your effort..
https://i.imgur.com/LdfHRia.mp4

I found out it is chromebook, when in portrait/flatmode it does not work correct either my example

so there will need to be a detection system to turn around left and right going seems to be up and down in flat mode

but when in landscape mode only also my app works correctly
https://iimgur.com/arviaqy.mp4 with pink circle

any idea how to turn up and down visa-versa with code?