Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Input

Inherits: Object

A singleton for handling inputs.

Description

The Input singleton handles key presses, mouse buttons and movement, gamepads, and input actions. Actions and their events can be set in the Input Map tab in Project > Project Settings, or with the InputMap class.

Note: Input's methods reflect the global input state and are not affected by Control.accept_event or Viewport.set_input_as_handled, as those methods only deal with the way input is propagated in the SceneTree.

Tutorials

Properties

MouseMode

mouse_mode

bool

use_accumulated_input

Methods

void

action_press ( StringName action, float strength=1.0 )

void

action_release ( StringName action )

void

add_joy_mapping ( String mapping, bool update_existing=false )

void

flush_buffered_events ( )

Vector3

get_accelerometer ( ) const

float

get_action_raw_strength ( StringName action, bool exact_match=false ) const

float

get_action_strength ( StringName action, bool exact_match=false ) const

float

get_axis ( StringName negative_action, StringName positive_action ) const

int[]

get_connected_joypads ( )

CursorShape

get_current_cursor_shape ( ) const

Vector3

get_gravity ( ) const

Vector3

get_gyroscope ( ) const

float

get_joy_axis ( int device, JoyAxis axis ) const

String

get_joy_guid ( int device ) const

Dictionary

get_joy_info ( int device ) const

String

get_joy_name ( int device )

float