Input
This section provides guidance for setting up inputs. The inputs that are currently supported are touch, keyboard, mouse, and gamepad.
Input Manager
In Studio, there are Inputs and Actions - the Input Manager sets up the mapping in between them. An action is an abstraction over the source of input(s) it receives. They are most useful for representing input as "logical" concepts (e.g. "jump") rather than as "physical" inputs (e.g. "space bar on keyboard pressed").
Manage Action Maps
You can manage Action Maps via the Input Manager in the Space Settings (the default state of the Inspector when no entity is selected).
Adding a Action
Actions are an abstraction layer to user inputs. To add a Action to the Action Map, click the (+) New Action
button then type in the name for your Action.
Adding a Binding to a Action
Bindings are how inputs can be associated with an action. To add a binding click the Add Binding
button and select the input you want to bind to the action in the dropdown. There are
Bindings for many types of inputs including keyboard, mouse and gamepad.
Multiple input bindings can be mapped to a single action. To delete a binding, click the trash bin next to the binding you want to delete.
Adding a Binding with a Modifier
Modifiers are an additional input you can assign to a binding in order activate the action. To create a Binding with an modifier, click the With Modifier
button. The modifier is selected with the first dropdown and the binding is selected with the second dropdown.
Creating a New Action Map
Action Map are sets of actions that can be swapped programmatically. To create a new action map click on the action map dropdown then click on Create New Action Map
. Then type in the name of the action map and save it. Action Maps can be renamed, duplicated, and deleted. The default action map can only be duplicated.
The currently selected Action Map is the Action Map that will be active by default.
Touch Events
See Events for how to listen on events.
Notes:
- Multiple screen touches can be active at the same time.
- Only one multitouch/single touch gesture will be active at a time.
Screen Touch
The following events are emitted for single touch actions:
ecs.input.SCREEN_TOUCH_START // Emits when the user initially touches the screen.
ecs.input.SCREEN_TOUCH_MOVE // Emits when the user moves their finger on the screen.
ecs.input.SCREEN_TOUCH_END // Emits when the user lift the finger off the screen.