InputMap
Inherits:Object
A singleton that manages allInputEventActions.
Description
Manages allInputEventAction which can be created/modified from the project settings menuProject > Project Settings > Input Map or in code withadd_action() andaction_add_event(). SeeNode._input().
Tutorials
Methods
action_add_event(action:StringName, event:InputEvent) | |
action_erase_event(action:StringName, event:InputEvent) | |
action_erase_events(action:StringName) | |
action_get_deadzone(action:StringName) | |
action_get_events(action:StringName) | |
action_has_event(action:StringName, event:InputEvent) | |
action_set_deadzone(action:StringName, deadzone:float) | |
add_action(action:StringName, deadzone:float = 0.2) | |
erase_action(action:StringName) | |
event_is_action(event:InputEvent, action:StringName, exact_match:bool = false)const | |
has_action(action:StringName)const | |
Method Descriptions
voidaction_add_event(action:StringName, event:InputEvent)🔗
Adds anInputEvent to an action. ThisInputEvent will trigger the action.
voidaction_erase_event(action:StringName, event:InputEvent)🔗
Removes anInputEvent from an action.
voidaction_erase_events(action:StringName)🔗
Removes all events from an action.
floataction_get_deadzone(action:StringName)🔗
Returns a deadzone value for the action.
Array[InputEvent]action_get_events(action:StringName)🔗
Returns an array ofInputEvents associated with a given action.
Note: When used in the editor (e.g. a tool script orEditorPlugin), this method will return events for the editor action. If you want to access your project's input binds from the editor, read theinput/*
settings fromProjectSettings.
boolaction_has_event(action:StringName, event:InputEvent)🔗
Returnstrue
if the action has the givenInputEvent associated with it.
voidaction_set_deadzone(action:StringName, deadzone:float)🔗
Sets a deadzone value for the action.
voidadd_action(action:StringName, deadzone:float = 0.2)🔗
Adds an empty action to theInputMap with a configurabledeadzone
.
AnInputEvent can then be added to this action withaction_add_event().
voiderase_action(action:StringName)🔗
Removes an action from theInputMap.
boolevent_is_action(event:InputEvent, action:StringName, exact_match:bool = false)const🔗
Returnstrue
if the given event is part of an existing action. This method ignores keyboard modifiers if the givenInputEvent is not pressed (for proper release detection). Seeaction_has_event() if you don't want this behavior.
Ifexact_match
isfalse
, it ignores additional input modifiers forInputEventKey andInputEventMouseButton events, and the direction forInputEventJoypadMotion events.
Array[StringName]get_actions()🔗
Returns an array of all actions in theInputMap.
boolhas_action(action:StringName)const🔗
Returnstrue
if theInputMap has a registered action with the given name.
voidload_from_project_settings()🔗
Clears allInputEventAction in theInputMap and load it anew fromProjectSettings.