world.input.actions maps low-level device state into reusable framework intent. It sits alongside the raw input devices:world.input.xrworld.input.keyboardworld.input.browserGamepads| Action | Value | Used By |
|---|---|---|
locomotion.move | 2D axis | Slide locomotion |
locomotion.turn | 1D axis | Snap/smooth turn |
locomotion.jump | button | Jump |
locomotion.teleportAim | button | Teleport aiming |
locomotion.teleportCommit | button | Reserved for explicit teleport confirmation |
interaction.select | button | Reserved for browser/XR selection adapters |
const world = await World.create(container, {
xr: false,
features: {
locomotion: {
browserControls: true,
},
},
});
browserControls: true binds WASD/arrow keys, Space, and standard browser gamepad controls to locomotion actions. Apps can still read raw devices directly or replace bindings on world.input.actions.const move = world.input.actions.getAxis2D('locomotion.move');
const jumping = world.input.actions.getButtonDown('locomotion.jump');
const PlayerJetpack = 'player.jetpack';
world.input.actions.addBinding({
source: 'keyboard',
kind: 'button',
action: PlayerJetpack,
code: 'ShiftLeft',
});
if (world.input.actions.getButtonPressed(PlayerJetpack)) {
// Apply your app-specific jetpack behavior.
}