axis

Type Event
Revision Release 2022.3683
Keywords axis

Overview

Axis events occur when analog data has been received from an InputDevice axis inputs. For example, axis events will be raised when a joystick has been moved, a gamepad's analog triggers have been pressed or released, a mouse has been moved, a scroll wheel has been moved, when movement has been detected on a touchpad/touchscreen, etc. This data is typically used by games which require analog controls.

Properties

Example

-- Called when an axis event has been received
local function onAxisEvent( event )
    print( event.axis.descriptor .. ": Normalized Value = " .. tostring(event.normalizedValue) )
end

-- Add the axis event listener
Runtime:addEventListener( "axis", onAxisEvent )