Input & Interaction

Grids overlays support two input modes: passthrough (Alt-key) and exclusive capture. The mode determines whether game input (movement, camera, etc.) is blocked while interacting with an overlay.

Input Modes

Passthrough Mode (Alt-Key)

The default mode. Overlays are visible but non-interactive. Holding Alt enables cursor-based interaction while keeping game input active in the background. Best for HUD elements, notifications, and overlays where you want quick peek-and-interact.

StateBehavior
Alt released (default)Mouse captured by game, cursor hidden, overlays are HitTestInvisible (visible but non-interactive)
Alt heldCursor appears, overlays become Visible (interactive), game also receives input
Alt + Right-clickLine trace from cursor → checks for IContextMenuProvider on hit actor → opens context menu overlay

Exclusive Capture Mode

For modal overlays like menus, dialogs, and search UIs where typing shouldn't move the character. When an overlay captures input exclusively, the player controller switches to UI-only input mode — all keyboard and mouse input goes to the overlay, none reaches the game.

StateBehavior
Overlay opens with captureCursor appears, game input fully blocked, overlay receives all input
Overlay closes / releases captureGame input restored, cursor hidden

When to use: Any overlay with text fields, search boxes, chat input, or complex interactions where WASD/mouse should not affect the game.

Using Input Capture

From C++ (creating overlays)

UWebOverlay* Overlay = Sys->CreateOverlay("my-menu", Url, 100);
Overlay->SetInteractive(true);
Overlay->SetCapturesInput(true);  // Blocks game input while this overlay is active

From JavaScript/TypeScript (at runtime)

import { grids } from '@grids/overlay-sdk';

// Request exclusive input capture (blocks game input)
grids.captureInput();

// Release exclusive input (game input restored)
grids.releaseInput();

The capture state is tracked globally by UWebOverlaySubsystem. If any visible and interactive overlay has bCapturesInput = true, the player controller switches to UI-only input mode. When the last capturing overlay is hidden, closed, or releases capture, game input is automatically restored.

Choosing the Right Mode

Overlay TypeModeExample
HUD / status displayPassthroughHealth bar, minimap
NotificationsPassthroughToast messages
Context menusPassthroughRight-click menus (quick select)
Asset browser / menusExclusive captureTab menu with search box
Chat / text inputExclusive captureIn-game chat overlay
Settings / dialogsExclusive captureConfiguration panels

Implementation Details

Alt-Key System

The Alt-key logic lives in AGridsPlayerController:

  1. Key down — Show mouse cursor, switch to GameAndUI input mode
  2. Key up — Dismiss context menus, hide cursor, restore GameOnly input mode
  3. Right-click while Alt held — Perform a line trace, check if the hit actor implements IContextMenuProvider, and open the context menu overlay via UContextMenuManager

Exclusive Capture System

Input capture is managed by the overlay subsystem with a delegate pattern:

  1. UWebOverlay::SetCapturesInput(true) marks the overlay as input-capturing
  2. UWebOverlaySubsystem::UpdateInputCaptureState() checks if any overlay is capturing
  3. OnInputCaptureChanged delegate fires, notifying AGridsPlayerController
  4. Controller switches to FInputModeUIOnly (capture) or FInputModeGameOnly (release)

Input Mapping

The system uses Unreal's Enhanced Input System:

Overlay Focus vs Input Capture

These are two separate concepts:

MethodEffect
grids.requestFocus() / releaseFocus()Toggles Slate hit-test visibility (whether clicks reach the overlay). Game input continues.
grids.captureInput() / releaseInput()Blocks/restores game input entirely. The overlay acts as a modal dialog.

You can combine both: requestFocus() makes the overlay interactive, captureInput() additionally blocks game input.

Build Mode Controls

Pressing B enters build mode. While build mode is active, a translucent preview follows the crosshair and left-click places a block at the previewed location and rotation. Rotation is fully 3-axis and synced to the server + persisted on placement.

Rotation keys

KeyAction
RRotate the active axis by + snap (default +15°)
Shift + RRotate the active axis by − snap
XSelect the Pitch (X) axis for subsequent R presses
YSelect the Roll (Y) axis
ZSelect the Yaw (Z) axis (default)
[Decrease snap size — cycles through 1°, 5°, 15°, 45°, 90°
]Increase snap size
Shift (hold)Temporarily switch to free rotate — each R press rotates by 1° regardless of snap
BackspaceReset rotation to (0, 0, 0)

Rotation keys are only active during placement (no block selected). If you've clicked a placed block to select it, rotation keys are disabled so they don't conflict with the selection editor. Press another shape button or build:deselect to return to placement mode.

Rotation UI

The build-editor overlay's rotation panel (bottom-center of the viewport during placement) mirrors every key in clickable form:

All overlay buttons call through to the same C++ entry points as the keys, so there is only ever one source of truth for placement rotation.

Multiplayer and persistence

Rotation is included in every block placement message: