Input on mobile
How input actions map to touch on the Decentraland mobile client.
Decentraland's input system is designed to be device-agnostic. The same InputAction enum that the SDK exposes on desktop is also routed from the on-screen controls on mobile, so most scenes work without any changes. There are, however, a few rules and gotchas worth knowing when you're building for touch.
For the full input model, see Click events. This page focuses on what is mobile-specific.
What touch maps to
Every InputAction that exists on desktop is also available on the mobile client — the on-screen controls simply route touch to the same SDK inputs. This means any scene that relies on the standard InputAction values will work on mobile out of the box.
The on-screen controls map as follows:
On-screen joystick — drives
IA_FORWARD/IA_BACKWARD/IA_LEFT/IA_RIGHTand avatar movement.Interaction button (bottom right) — fires
IA_POINTER(the left mouse button on desktop) against whatever the player is aiming at.E button — fires
IA_PRIMARY(theEkey on desktop).F button — fires
IA_SECONDARY(theFkey on desktop).Jump button — fires
IA_JUMP(theSpacekey on desktop). This is the largest button on the HUD and is always easy to reach.1 / 2 / 3 / 4 buttons — fire
IA_ACTION_3/IA_ACTION_4/IA_ACTION_5/IA_ACTION_6respectively. These live behind a secondary menu (see below).Camera drag — rotates the camera; not exposed as an
InputAction.
Inputs to avoid for key actions on mobile
All InputAction values are reachable on mobile, but IA_ACTION_3–IA_ACTION_6 (the 1/2/3/4 buttons) are tucked away behind a secondary menu and are not easily reachable during gameplay. If your scene uses them as primary actions, mobile players will not be able to trigger them comfortably.
Avoid binding key actions to:
IA_ACTION_3— the1key on desktop /1button on mobileIA_ACTION_4— the2key on desktop /2button on mobileIA_ACTION_5— the3key on desktop /3button on mobileIA_ACTION_6— the4key on desktop /4button on mobile
Prefer instead:
IA_POINTERfor the main tap / interaction buttonIA_PRIMARYfor the E button actionIA_SECONDARYfor the F button actionIA_JUMPwhen an action maps naturally to jumping (it's the largest and most reachable button on the mobile HUD)Proximity-based triggers (see Proximity Events) when an action should fire automatically as the player approaches an entity
Cursor lock
The PointerLock component is a desktop-client concept (locked vs. unlocked mouse cursor). It does not apply to touch on mobile and is safe to leave in your scene — it has no effect there.
Related
Last updated