加速度计和校准 - iPhone SDK
我需要在 iPhone 游戏中使用加速计的功能。我只需通过倾斜设备来移动图像即可。然而,YouTube 上的大多数视频仅显示以某种方式反转的倾斜功能,而忘记包含校准。
我希望用户将他们的设备校准到他们所处的任何位置。有谁知道我应该如何开始?
I need to use the functionality of an accelerometer in my iPhone game. I just have to move an image by tilting the device. However most videos on YouTube just show the tilt feature that is somehow inverted and forget to include the calibration.
I want the user to calibrate their device to whatever position they're in. Does anyone know how I should get started on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我曾经做过一个这样的应用程序。我会将其发布在这里,但它适用于 iOS 4...
要校准:
并且....
h 文件:
移动代码:
大多数情况下应该可以工作。
I made an app like this once. I'll post it here, but it's for iOS 4...
To calibrate:
And...
.h file:
Move code:
Should work most of the time.