加速度计采样率 [英] Accelerometer samplerate

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

问题描述

我的加速度计遇到了一些问题。当我刚开始开发游戏时,控件感觉非常敏捷且精确,但是当添加更多图形元素时,加速度计的反应就像是反应很晚,有时甚至不如以前。我的帧速率约为40fps。

I'm having some problems with the accelerometer. When I first started develop my game the controls felt very snappy and precise, but when adding more graphical elements the accelerometer feels like it's reacting very late and sometimes not as precise as before. I'm having a framerate of around 40fps.

这是我读取值的地方(据我估计)

This is where I read the values (as i'm supposed to I guess)

- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration;

这是常见的还是预期的行为,或者我可以做些什么吗?采样率和精度可以控制吗?还是在发生这种情况时做错了什么?

Is this a common and expected behaviour or can I do something about it? Can the sample rate and precision be controlled? Or have done something wrong if this happens?

推荐答案

如果您的游戏之前和现在都没有响应,那么很有可能加速度计的更新速度不是问题。您如何将加速度计事件传播到游戏循环中?如果定向更新的速度快于主循环消耗的速度,那会感觉像是额外的延迟。

If your game felt responsive before and now it doesn't, then chances are that the accelerometer update rate isn't the issue. How are you propagating the accelerometer events up into the game loop? If your orientation updates are coming in at a rate faster than the main loop is consuming them, that can feel like additional latency.

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

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