开发者

Accelerometer detecting side to side movements

开发者 https://www.devze.com 2022-12-17 01:54 出处:网络
can someone please give me an example of how you detect if the iphone is moving left or moving right. like a long version of a shake i want my app to be able to know if the users arm is going right or

can someone please give me an example of how you detect if the iphone is moving left or moving right. like a long version of a shake i want my app to be able to know if the users arm is going right or left. imagine your hand like a window wiper with the phone at the end

any ideas?

Thanks, Sam :开发者_如何转开发P


That would be the acceleration.x value. Imagine 3 lines going through your iPhone:
1) a line perpendicular to your iPhone screen and going through it, that would be Z.
2) a horizontal and parallel line to your screen, that would be X (what you're looking for).
3) a vertical and parallel line to your screen, that would be Y.

So, moving the iPhone left or right will generate changes in the X graph. Moving the iPhone up or down will generate changes in the Y graph. Moving your iPhone forward or backward will generate changes in the Z graph.
Hope this helps you grasp the accelerometer's concept,
~ Natanavra.

0

精彩评论

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

关注公众号