开发者

Music in my game disturbs accelerometer values. How to solve this?

开发者 https://www.devze.com 2023-01-22 16:19 出处:网络
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 resul

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号