Interaction
The look-at cursor
LookAtCursor (from @maomi/sge/cursor) is the canonical interaction cursor: a DOM crosshair that raycasts through screen center every frame, focuses whatever interactable it lands on, and clicks it.
const cursor = new LookAtCursor(player);
fps.add(cursor); // it's a GraphicEntity — the entity loop ticks itInteractable
Interaction is duck-typed — implement the capability interface on any entity:
import type { Interactable } from '@maomi/sge/cursor';
class Portal extends Box implements Interactable {
interactRange = 6; // meters; beyond it, no focus
onCursorEnter() { /* glow on */ }
onCursorLeave() { /* glow off */ }
onCursorSelect(player: Player) { /* clicked */ }
}The cursor resolves the physics hit back to the entity via the id stamped on its collision shape, checks range, and drives enter/leave/select. The crosshair grows when something is focused — the visual cue that a click will land.
Because the interfaces are structural (no base class), they survive hot module reloads: an entity from an old module version still duck-types correctly.
Shooter reticles
For hitscan games, two lighter cursors:
Crosshair— an SVG reticle that tints when the center ray hits anything.LaserPointer— aTHREE.Linefrom the camera into the world, ending at the hit point.
Both build on the same raycastFromCamera path as the look-at cursor — one raycasting implementation across the engine.
Characters are not ray-pickable
Physics raycasts hit rigid bodies only — a character's ghost is invisible to them. To pick characters (NPCs, bots), use a THREE.Raycaster against their meshes instead.
Speech bubbles
SpeechBubble (from @maomi/sge/bubble) is an in-world HTML bubble (CSS2D): text and optional choice buttons, anchored above an entity — the engine's primitive for dialogue. The CSS2D overlay is pointer-transparent; a bubble with buttons re-enables pointer events on itself.