Skip to main content

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, right scroll_move

Windows Mixed Reality controllers​

  • Joystick/Thumbstick west/east (right) → snap rotate
  • Trackpad pressed move (left) → move
  • Trackpad down → right action_primary_down, left settingspanel
  • 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, right scroll_move
  • Trackpad center down/up → left settingspanel, right action_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/stop
  • 5 → primary grab/release
  • 9 → settings panel
  • 10 and 6 → boost down/up
  • 2 → shoot start/stop
  • 14 / 15 → snap rotate left/right
  • 7 → action primary down / primary release
  • axisMoveWithDeadzone → move

Action sets​

Action sets separate “driving” controls from “menu / HUD” controls. Only one action set is active at a time.

  • 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

Behaviours​

Behaviours define how raw device inputs are interpreted (e.g., D-pad emulation, deadzones, scrolling).

  • oculus-touch-controls: joystick_dpad4Xr, msft_mr_axis_with_deadzoneXr

  • meta-touch-controls: joystick_dpad4Xr, msft_mr_axis_with_deadzoneXr

  • vive-controls: trackpad_dpad4, trackpad_scrolling

  • windows-motion-controls: joystick_dpad4Xr, msft_mr_axis_with_deadzoneXr, trackpad_dpad4

  • generic-tracked-controller-controls: joystick_dpad4Xr, msft_mr_axis_with_deadzoneXr, trackpad_dpad4

  • daydream-controls: trackpadday_dpad4

  • gearvr-controls: trackpad_dpad4, trackpad_scrolling

  • oculus-go-controls: trackpad_dpad4

  • gamepad-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.behaviours entries 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