views:

82

answers:

1

Hi.

I'm writing a game where the player tilt the phone to control a character.

The problem is: the music(when playing loud) and sound effect(like gun shots) disturbs the accelerometer values. This result in weird character movement.

Please give me some advice on how to solve this.

Thank you in advance!

+4  A: 

Perhaps you need to adjust the sensitivity of your app to the accelerometer data? It sounds like you are letting even the slightest movements cause character movements. Can you increase the "noise" threshold such that they have to tilt just a little bit more to get the character to move but not let sound vibrations adjust movements?

In other words, if the delta of the accelerometer change from resting position/last valid accelerometer reading is greater than some threshold value, then accept the new accelerometer reading.

Bryan Denny