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.

Mappings

Mappings connect device events to action names. These are the active bindings for the default mapping set.

Keyboard

  • Maction_mute
  • F press/up → shoot_start/stop
  • Vthirdview_toggle
  • W/A/S/D and arrow keys → directional down/up actions
  • E / Q → snap rotate right/left
  • Rreposition
  • Llookatme
  • F (down) → flyme
  • Htoggle_ui
  • F4free_camera_toggle
  • Shiftboost_down/up
  • Spacejump_start/stop
  • Escapeescape_down
  • ^ (backquote) → backquote_down

Vive controllers

  • Trackpad pressed movemove
  • Trackpad west/east presssnap_rotate_left / snap_rotate_right
  • Trackpad center/north/south pressaction_primary_down
  • Trackpad upaction_primary_up
  • Menumenue (down), thumb_up (up)
  • Grip → grab/release + finger states
  • Trigger → grab/release + finger states
  • Scrollmove_duck

Oculus Touch controllers

  • Joystick west/eastsnap_rotate_left / snap_rotate_right
  • Trackpad pressed movemove
  • Trigger (right) → action_primary_down/up, shoot_start/stop
  • Trigger (left) → boost_down/up
  • Gripprimary_action_grab/release + finger states
  • A → teleport start/stop
  • X → jump start/stop
  • Yflyme
  • Bsettingspanel
  • Axis move → left move, right scroll_move

Windows Mixed Reality controllers

  • Joystick/Thumbstick west/east → snap rotate
  • Trackpad pressed movemove
  • Trackpad down → right action_primary_down, left settingspanel
  • Trackpad up → right action_primary_up
  • Menumenue (down/up)
  • Grip/Trigger → grab/release + click + finger states
  • 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 → primary / teleport start-stop (Oculus Go)
  • North/South → menu / shoot (varies per device mapping)
  • Trigger → shoot + grab + primary (Oculus Go mapping)

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

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

  • 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.

The registerInputMappings function takes a configuration object. If you set replace: true, it will completely replace the mappings for a given device and action set. If replace is false or omitted, it will merge the new mappings with the existing ones.

Example

Here is an example of a component that registers a new reload action, mapping it to the R key.

class SampleElement extends CapElement {
schema = {}
@query('#player-rig')
playerRig
async init() {
const config = {
replace: true,
mappings: {
default: {
keyboard: {
keyr_down: 'reload',
},
},
},
}
AFRAME.registerInputMappings(config)
this.el.sceneEl.addEventListener('reload', () => {
console.info('reload')
})
}
}
export default SampleElement