GetInputAxisValue

From Onset Developer Wiki
Revision as of 17:14, 26 September 2019 by BlueMountains (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
GetInputAxisValue

Type: Function
Context: Client
Introduced: v1.0

Description

Gets the value of input axis keys.

Axis Mappings
AxisName Keys
MoveForward W, S, Up, Down, Gamepad Left Thumbstick Y-Axis
MoveRight A, D, Gamepad Left Thumbstick X-Axis
Turn Mouse X
LookUpRate Gamepad Right Thumbstick Y-Axis
LookUp Mouse Y
Throttle W, Gamepad Right Trigger
Brake S, Gamepad Left Rigger
MoveVertical Left Shift, Left Ctrl
MoveTurn E, Q
Handbrake Space Bar

Syntax

GetInputAxisValue(AxisName)

Parameters

  • AxisName
    Name of the input axis key.

Return Value

  • Returns the value of the input axis key between -1.0 and 1.0.

Example

function OnRenderHUD()
    local IsMovementInput = (math.abs(GetInputAxisValue("MoveForward")) + math.abs(GetInputAxisValue("MoveRight"))) not 0.0;
    if IsMovementInput then
        DrawText(10, 10, "You are moving")
    end
end
AddEvent("OnRenderHUD", OnRenderHUD)

See also

__EDIT_ME__