Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Accelerometer acting peculiarly

Author
Message
hakimfullmetal
4
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 22nd Feb 2015 08:52 Edited at: 22nd Feb 2015 19:13
Hello everybody.
So I was tinkering around with accelerometer and gyroscope.
I made a snippet that will move the camera using accelerometer, and rotate the camera depending on the gyroscope input.

When I rotate the smartphone, the input from gyroscope will rotate the camera. This works flawlessly. But the accelerometer got me scratching my head.

To my understanding, the accelerometer will return values of the smartphone movement, not rotation. So If I move to the right, GetRawAccelX() will return positive value.

But, I noticed that the accelerometer did not respond to the direction of my movement, but to the direction of which my smarphone is facing.
For example, when I tilt the smarphone down, GetRawAccelX() gives some values, and the camera moves. When I point it upward, it moves in opposite direction.

To make it clear, I want the camera to move to the right when I move my smartphone to the right. The same goes for the other direction (left, front, down, up, back). I suppose this will require the command to return linear velocities, but I can't find the command that do this.

Am I doing something wrong? Was I getting the concept of acccelerometer input wrong?
If I'm wrong, is there any way to get the values of the smartphone movement? For example, when I move my smartphone to the right, I want some values that signifies its movement to the right.

Here's the snippet:

Login to post a reply

Server time is: 2019-08-20 03:48:53
Your offset time is: 2019-08-20 03:48:53