In-Game Actions & Input Mappings
This page documents the action sets (inGameActions) and the input configuration (config) used to map device inputs (VR controllers, gamepads, keyboard) to gameplay actions. Tracked hands do not use these mappings; see Hand Tracking Gestures.
Mappings
Mappings connect device events to action names. These are the active bindings for the default mapping set.
Keyboard
- M →
action_mute - F press/up →
shoot_start/stop - V →
thirdview_toggle - W/A/S/D and arrow keys → directional down/up actions (
w_down,a_up, ...) - E / Q → snap rotate right/left
- R →
reposition - L →
lookatme - F (down) →
flyme - H →
toggle_ui - F4 →
free_camera_toggle - Shift (left or right) →
boost_down/up - Space →
jump_start/stop - C →
crouch_down/up - 1–0 → avatar gestures (
avatar_gesture_<name>_down/up): fist, thumbs up, point, peace, rock, OK, salute, wave, clap, left wink - Escape →
escape_down - ` (Backquote, the key left of 1; ^ on German layouts) →
backquote_down
Keys pressed together with Ctrl, Alt or Meta are treated as shortcuts and do not trigger actions.
Vive controllers
- Trackpad pressed move (left) →
move - Trackpad west/east press (right) →
snap_rotate_left/snap_rotate_right - Trackpad center/north/south press (right) →
action_primary_down - Trackpad up (right) →
action_primary_up - Menu →
menue(down),thumb_up(up) - Grip → grab/release + finger states
- Trigger → grab/release + finger states
- Scroll (right) →
move_duck
Oculus / Meta Touch controllers
The oculus-touch-controls and meta-touch-controls mappings are identical.
- Joystick west/east (right) →
snap_rotate_left/snap_rotate_right - Trackpad pressed move (left) →
move - Trigger (right) →
action_primary_down/up,shoot_start/stop - Trigger (left) →
boost_down/up - Grip →
primary_action_grab/release+ finger states - A →
action_teleport_start/action_teleport_stop - X →
jump_start/jump_stop - Y →
flyme - B →
settingspanel - Axis move → left
move, rightscroll_move
Windows Mixed Reality controllers
- Joystick/Thumbstick west/east (right) → snap rotate
- Trackpad pressed move (left) →
move - Trackpad down → right
action_primary_down, leftsettingspanel - Trackpad up → right
action_primary_up - Menu →
menue(down/up) - Grip → grab/release + click + finger states
- Trigger → left: grab/release + click + finger states; right:
shoot_start/stop - Axis move → left
move, rightscroll_move - Trackpad center down/up → left
settingspanel, rightaction_primary_down/up
Daydream / GearVR / Oculus Go
- Trackpad D-pad west/east → snap rotate
- Center press →
action_primary_down(Daydream, GearVR); teleport start/stop (Oculus Go) - North/South press → Daydream: shoot / menu; GearVR: menu / shoot; Oculus Go: south opens the menu
- Trigger → Daydream: grab + click; GearVR: primary action; Oculus Go: shoot + grab + primary action
Gamepad
0→ jump start/stop5→ primary grab/release9→ settings panel10and6→ boost down/up2→ shoot start/stop14/15→ snap rotate left/right7→ action primary down / primary releaseaxisMoveWithDeadzone→ move
Action sets
Action sets separate “driving” controls from “menu / HUD” controls. Only one action set is active at a time.
- default (gameplay)
- hud (UI)
- move — Move
- snap_rotate_left — Snap Rotate Left
- snap_rotate_right — Snap Rotate Right
- action_mute — Mute
- action_teleport_down — Teleport Aim
- action_teleport_up — Teleport
- action_share_screen — Share Screen
- escape — Escape
- free_camera_toggle — Toggle Free Camera
- crouch_down — Crouch
- action_ui_select_down — Select UI item
- action_ui_select_up — Select UI item
Behaviours
Behaviours define how raw device inputs are interpreted (e.g., D-pad emulation, deadzones, scrolling).
- default
oculus-touch-controls:
joystick_dpad4Xr,msft_mr_axis_with_deadzoneXrmeta-touch-controls:
joystick_dpad4Xr,msft_mr_axis_with_deadzoneXrvive-controls:
trackpad_dpad4,trackpad_scrollingwindows-motion-controls:
joystick_dpad4Xr,msft_mr_axis_with_deadzoneXr,trackpad_dpad4generic-tracked-controller-controls:
joystick_dpad4Xr,msft_mr_axis_with_deadzoneXr,trackpad_dpad4daydream-controls:
trackpadday_dpad4gearvr-controls:
trackpad_dpad4,trackpad_scrollingoculus-go-controls:
trackpad_dpad4gamepad-controls:
joystick_dpad4
Overriding Mappings
You can override or extend the default input mappings by creating a custom component and using AFRAME.registerInputMappings. This is useful for adding new actions or changing existing keybindings.
AFRAME.registerInputMappings(config) merges config into the active mappings:
- An event you list replaces that event's current binding on the same device; all other bindings stay.
- With
replace: true, any other event on the same device that is bound to the same action is removed first, so the action ends up on your key only. config.behavioursentries are merged per device.
Keyboard actions are emitted on the scene, so listen on this.el.sceneEl.
Example
Here is an example of a component that registers a new reload action on the R key. R is bound to reposition by default; this mapping takes the key over.
class ReloadKey_5d1e7a2c extends CapElement {
static schema = {}
init() {
const config = {
replace: true,
mappings: {
default: {
keyboard: {
keyr_down: 'reload',
},
},
},
}
AFRAME.registerInputMappings(config)
this.el.sceneEl.addEventListener('reload', () => {
console.info('reload')
})
}
}
export default ReloadKey_5d1e7a2c