Iphone-SDK:加速度计 x、z 为 360 度?
如何获取加速度计产生的 x、z 值并将其转换为值 这将代表 iPhone 360 度旋转中的一个点? (景观) 它可以是-2到2(0代表中间点),也可以是0到360,只要它代表整个iphone旋转的值。
我正在制作的风景游戏需要它 在这种情况下最好的解决方案是什么?
How is it possible to take the x,z values produced by the accelerometer and translate it as values
that will represent a point in 360 degrees of the iphone rotation? (LANDSCAPED)
it can be -2 to 2 (0 for the middle point) and it can be 0 to 360, as long as it represents a value for the whole iphone rotation.
I need it for a Landscape game im making
what is the best solution in that case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 atan2() 函数。要获取以度为单位的值:
Use the atan2() function. To get a value in degrees: