Type Number Object InputAxis Revision Release 2024.3703 Keywords device, input, axis, accuracy
The +/− accuracy of the data provided by the axis input. This value will always be greater than or equal to 0
. For example, if the accuracy is 0.01
, an axis value of 0.5
is accurate between 0.49
and 0.51
.
This applies to the axis raw value, not the normalized value.
An accuracy of 0
may indicate perfect accuracy, but it will more likely mean that the accuracy of the input device is unknown.
You can use this property to eliminate "noise" generated by an axis input device by ignoring axis values that are not beyond the accuracy range of the last recorded axis value.
-- 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 accuracy values for axisIndex = 1,#inputAxes do local inputAxis = inputAxes[axisIndex] print( inputAxis.descriptor .. ": Accuracy = " .. tostring(inputAxis.accuracy) ) end end