system.setAccelerometerInterval()

类型 函数
system.*
返回值
修订版 发布 2024.3703
关键词 加速计
另请参阅 加速计

概览

设置 加速计 事件的频率。

在 Android 和 iOS 上,默认值未记录,但通常较低,例如 10 Hz。

加速计事件非常耗电,因此只有在需要更快的响应时才提高频率。

问题

settings =
{
    iphone =
    {
        plist =
        {
            NSMotionUsageDescription = "This app would like to access the accelerometer.",
        },
    },
}

语法

system.setAccelerometerInterval( frequency )
频率 (必需)

数字. 测量间隔(以 Hz 为单位)。

示例

-- Set the measurement interval to 50 Hz
-- This makes the system take 50 measurements per second
system.setAccelerometerInterval( 50 )