0

你好 StackOverflowers,

我正在为 Android 设计一款游戏,我计划允许用户在四个不同的方向(上、下、左和右)上移动。我想使用 Sensor.TYPE_ACCELEROMETER 或 Sensor.TYPE_ORIENTATION 来实现这一点。如果我只执行上述四个指定的方向,那么使用 Sensor.TYPE_ACCELEROMETER 是否优于 Sensor.TYPE_ORIENTATION,反之亦然?提前感谢您的回答、帮助和建议。

贾斯汀。

4

1 回答 1

1

When you say "move" do you mean tilt or translate?

Using the accelerometer and gyroscope simultaneously should give the coverage of motion necessary to divine up,down,left,right. So use TYPE_ACCELEROMETER and TYPE_GYROSCOPE in a coordinated fashion.

Sensor.TYPE_ORIENTATION is deprecated, I believe.

I caveat this answer by saying I am primarily an iOS developer, only have a couple of finished Android projects and both are NDK based....

于 2013-05-21T21:00:36.593 回答