加速度计检测左右移动 [英] Accelerometer detecting side to side movements

查看:153
本文介绍了加速度计检测左右移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能不能给我一个例子,说明如何检测iPhone是向左移动还是向右移动。就像摇晃的长版本一样,我希望我的应用能够知道用户手臂是向右还是向左。想像一下你的手就像擦玻璃的雨刮器,手机末尾

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

有什么想法吗?

谢谢,Sam: P

推荐答案

那将是加速度。x的值。想象一下,有3条线穿过您的iPhone:

1)一条垂直于iPhone屏幕并穿过它的线,即Z。

2)与您的iPhone屏幕平行的水平线屏幕上将是X(您要查找的内容)。

3)屏幕垂直和平行线,即Y。

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.

因此,向左或向右移动iPhone将会在X图形中生成更改。向上或向下移动iPhone会在Y曲线图中产生变化。向前或向后移动iPhone会在Z图中产生变化。


希望这可以帮助您掌握加速度计的概念,

〜Natanavra。

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.

这篇关于加速度计检测左右移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆