views:

131

answers:

1

Hi to all

I am developing one game where I want to move UIImageView based on accelerometer. When I rotate iphone device left to right or right to left the UIImageView have to rotate in particular angle. It's moving also but the problem occurs when I play background sound because of that sound, it sends some acceleration point even if my iphone is idle. So my UIImageView is also moving. It should not happen. When I decrease the iphone sound volume it works very well. What I have to do for that.

And also if anyone knows how to get acceleration point only when iphone is moving from left to right or right to left. It should not detect when iphone is xz or yz plane.

If anybody knows the solution please reply.

+2  A: 

Have you got any filtering on the input from the accelertometer? I would expect the noise from the speaker the accelerometer is picking up is vastly different in amplitude and frequency than the game control.

There is a simple low pass filter in the Apple accelerometer graph sample code.

Roger Nolan
This sounds reasonable. I wouldn't have expected that the minimal vibration due to playing a sound would be an issue, but maybe Jyoysna's application is set up to be particularly sensitive.
Mark Bessey
Thank you Roger for your response. I able to fix the problem.
Jyotsna