我如何将 iPhone 运动检测用于类似摇蛋的应用程序?

发布于 2024-09-13 19:50:20 字数 262 浏览 2 评论 0原文

我希望构建一个类似于那些摇蛋应用程序的应用程序,以更好地理解如何在 iPhone 上检测运动。我一直在研究加速度计方法以及运动和运动方法,但似乎无法完成我想做的事情。

我的具体需求如下:我希望能够在用户将手机摇开时播放一种声音,并在用户向他们摇动手机时播放另一种声音。用户的动作与摇蛋器非常相似,根据他们是否将设备移向或远离胸部,可以播放两种不同的声音。测量它们离开或靠近的强度也是很好的。

有什么想法吗?

我在苹果的示例代码中搜索了类似的应用程序,但似乎没有。

I am hoping to build an application similar to those egg shaking applications, to better understand how to detect motion on the iphone. I've been looking at accelerometer methods and motion and motion methods, but can't seem to get working what I want to do.

The specifics of my need are as follows: I want to be able to play one sound when user shakes the phone away from them, and play another sound when they shake back towards them. The motion from the user would be very similar to an egg shaker, with two different sounds able to be played depending on whether they moved the device towards or away from their chest. It would also be good to measure the intensity with which they moved away or towards.

Any ideas?

I've searched apple's sample code for a similar application, but there doesnt seem to be one.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幸福不弃 2024-09-20 19:50:20

看看这个开源游戏,它充分利用了加速度计。能够知道自己要去哪个方向是一件好事,但我并没有在强度上搞砸太多。我相信一旦你了解了细节就很容易了。

http://github.com/haqu/tweejump

Look at this game which is open source and makes great use of the accelerometer. It's a good one to be able to tell which direction you are going, but I haven't messed around much with intensity. I'm sure it's easy enough once you get into the details.

http://github.com/haqu/tweejump

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文