类型 数字 对象 InputAxis 修订版 2024.3703 版 关键字 设备、输入、轴、最大值、最大值、值
指示轴输入事件将提供的最大值。此属性和 object.minValue 属性是理解轴接收的原始数据的必要条件,因为它将指示该轴在其范围内已移动的距离。
操纵杆通常具有分别为 1.0
和 -1.0
的最大值和最小值范围。
触摸屏的最大值通常是屏幕的长度(以像素为单位),最小值为 0
。
触摸板的最大值通常是一个使用未知测量单位的大值,这意味着您必须根据最小值和最大值属性评估所接收轴数据的相对位置。
-- Fetch all input devices currently connected to the system local inputDevices = system.getInputDevices() -- Traverse all input devices for deviceIndex = 1,#inputDevices do -- Fetch the input device's axes local inputAxes = inputDevices[deviceIndex]:getAxes() -- Print all axis maximum property values for axisIndex = 1,#inputAxes do local inputAxis = inputAxes[axisIndex] print( inputAxis.descriptor .. ": Max value = " .. tostring(inputAxis.maxValue) ) end end