Music in my game disturbs accelerometer values. How to solve this?
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 开发者_JAVA百科on how to solve this.
Thank you in advance!
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.
精彩评论