BATTLEBOX: Robot Combat Arena
README.md
editor.view
BATTLEBOX's 3D build view, the garage's robot maker. It shows the open editor.session design on a build stand in front of the screw pit. It edits that design only through the session. It uses bots.assembler (build, then updatePart / addPart / removePart per change) when available, and simple primitive stand-ins otherwise.
What it draws and does:
- Stand: a floor grid at 1, 5 or 10 cm by the move snap, the centre line and mirror plane, X/Y/Z axes and the size-limit box (
Parts.BOUNDS). - Camera: an orbit/pan/zoom camera, read by
game.ArenaCam'sbuildshot. Presets are front, side, top, iso and back;Ffocuses the selection. - Placement:
beginPlace(type)shows a ghost of the new part that snaps flush onto the face under the pointer (ray against the parts' oriented boxes). Wheels go axle-out, plates lie flat and weapons face outward. With mirror mode on, the ghost's mirror twin shows too. - Selection: click selects, Shift adds, and clicking empty space clears. Hover and selection get outlines.
- Gizmos: move (axis arrows and plane handles), rotate (yaw, pitch and roll rings, snapped by the session) and scale (local axis handles honouring
sizeRule). Each drag is one session drag, so it is one undo step. - Overlays: centre of mass, wheel ground contact, weapon strike zones and sweep circles, and problem (red) or warning (amber) parts from
stats.issues. - Input: mouse, touch (tap, one-finger orbit, two-finger pinch and pan) and gamepad (stick orbit, trigger zoom, D-pad nudge, shoulder rotate). Shortcuts come from
editor.buildView.
The module header documents the whole API: active, beginPlace, cancelPlace, placing, setTool, tool, setView, focus, hovered, hoveredHandle, dragging, setPointerBlocker, setPadEnabled, setOverlays, on, cameraPose, stats and toScreen.
Hosted by the editor.BuildView component, which game.ArenaCam spawns while phase is garage. The garage panels (screens/) call the API.