Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(office): Mission Control becomes a round holo deck, usable from every side

rubenluetke10-beep2eaf4e276a12
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsx b/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsx
index f0bb333db2..9c2a033d2a 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsx
@@ -131,6 +131,8 @@ export function CheckpointMarker({ checkpoint, label, icon, active, animate, onA
const phase = useMemo(() => [...checkpoint.id].reduce((sum, ch) => sum + ch.charCodeAt(0), 0) % 7, [checkpoint.id]);
const t = useT();
const hint = t(`society.office.cp_${checkpoint.id}_hint`);
+ // A checkpoint over a tall prop (the holo deck) floats its token above it.
+ const tokenY = checkpoint.tokenY ?? TOKEN_Y;
const face = faceMaterial(icon);
const ringOpacity = active ? 0.95 : 0.6;
const fillOpacity = active ? 0.16 : 0.07;
@@ -142,14 +144,14 @@ export function CheckpointMarker({ checkpoint, label, icon, active, animate, onA
// the time); animation only adds a gentle bob and sway around that.
const toCamera = Math.atan2(camera.position.x - checkpoint.x, camera.position.z - checkpoint.z);
if (animate) {
- token.current.position.y = TOKEN_Y + Math.sin(time * 1.8) * 0.07;
+ token.current.position.y = tokenY + Math.sin(time * 1.8) * 0.07;
const sway = Math.sin(time * (active ? 2.2 : 1.1)) * (active ? 0.45 : 0.3);
const goal = toCamera + sway;
// Ease towards the goal along the shorter way round, so orbiting never snaps it.
const diff = Math.atan2(Math.sin(goal - token.current.rotation.y), Math.cos(goal - token.current.rotation.y));
token.current.rotation.y += diff * Math.min(1, delta * 6);
} else {
- token.current.position.y = TOKEN_Y;
+ token.current.position.y = tokenY;
token.current.rotation.y = toCamera;
}
}
@@ -208,14 +210,14 @@ export function CheckpointMarker({ checkpoint, label, icon, active, animate, onA
</mesh>
{/* Floating hexagon token with the icon on both faces. */}
- <group ref={token} position={[0, TOKEN_Y, 0]} rotation={[0, Math.PI / 4, 0]} scale={active ? 1.15 : 1}
+ <group ref={token} position={[0, tokenY, 0]} rotation={[0, Math.PI / 4, 0]} scale={active ? 1.15 : 1}
onClick={activate} onPointerOver={over} onPointerOut={out}>
<mesh geometry={prismGeometry} material={rimMaterial} castShadow />
<mesh geometry={faceGeometry} material={face} position={[0, 0, TOKEN_DEPTH / 2 + 0.002]} />
<mesh geometry={faceGeometry} material={face} position={[0, 0, -TOKEN_DEPTH / 2 - 0.002]} rotation={[0, Math.PI, 0]} />
</group>
- <group ref={anchor} position={[0, LABEL_Y, 0]}>
+ <group ref={anchor} position={[0, tokenY - TOKEN_Y + LABEL_Y, 0]}>
<Html center zIndexRange={[20, 0]}>
<button ref={pill} type="button" data-office-ui className="office-checkpoint" data-active={active ? "true" : "false"}
aria-label={hint ? `${label}: ${hint}` : label} title={hint || undefined}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/MissionConsole.tsx b/jarvis/ui/web/frontend/src/components/society/office/MissionConsole.tsx
index 0ba3839e3d..327c58f636 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/MissionConsole.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/MissionConsole.tsx
@@ -1,95 +1,323 @@
/**
- * Mission Control's console ring on the coding floor: six slanted consoles
- * facing outwards around a projector that holds a slowly turning holo-globe.
+ * Mission Control's holo deck on the coding floor, in the style of a
+ * superhero's workshop: a round glass command table on a lit pedestal, a HUD
+ * glowing in its top, a light column feeding a turning wireframe globe with
+ * orbit rings, floating data panels all the way round and drifting sparks.
*
* Built in local space centred on the origin and kept inside the
- * `missionConsole` footprint (3.2 m × 3.2 m, 2.2 m high) that navigation
- * walks around. Geometries and materials are module-level singletons.
+ * `missionConsole` box (FURNITURE_SIZE). The deck is round, so it is not a
+ * solid box: navigation walks around `missionDeckObstacles` instead, strips
+ * inside the table's circle — nobody bumps into air beside it. A click
+ * anywhere on the deck opens Mission Control.
*/
-import { useRef } from "react";
-import { useFrame } from "@react-three/fiber";
+import { useEffect, useMemo, useRef } from "react";
+import { useFrame, type ThreeEvent } from "@react-three/fiber";
import { useReducedMotion } from "framer-motion";
-import { CylinderGeometry, MeshStandardMaterial, SphereGeometry, TorusGeometry, type Group } from "three";
-import { Box, matte, Rounded } from "./OfficeFurniture";
-import type { Furniture, FurnitureKind } from "./officeLayout";
+import {
+ AdditiveBlending, BufferGeometry, CircleGeometry, CylinderGeometry, DoubleSide, Float32BufferAttribute,
+ IcosahedronGeometry, MeshBasicMaterial, MeshStandardMaterial, PlaneGeometry, PointsMaterial, RingGeometry,
+ SphereGeometry, TorusGeometry, type Group, type Texture,
+} from "three";
+import { cachedCanvasTexture } from "./canvasMaterials";
+import { MISSION_DECK_RADIUS, MISSION_TABLE_RADIUS, type Furniture, type FurnitureKind } from "./officeLayout";
+import { useOfficeStore } from "./officeStore";
-const HOLO = "#38bdf8";
+const CYAN = "#38e1ff";
+const ICE = "#b8f3ff";
+const AMBER = "#ffb347";
+
+// ---------------------------------------------------------------------------
+// Canvas faces: the HUD in the table top and the floating panels.
+// ---------------------------------------------------------------------------
+
+function glow(ctx: CanvasRenderingContext2D, colour: string, blur = 10): void {
+ ctx.strokeStyle = colour;
+ ctx.fillStyle = colour;
+ ctx.shadowColor = colour;
+ ctx.shadowBlur = blur;
+}
+
+/** The round HUD in the table top: range rings, ticks, sweep arcs and blips. */
+function drawTableHud(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const c = w / 2;
+ ctx.clearRect(0, 0, w, h);
+ glow(ctx, CYAN, 8);
+ ctx.lineWidth = 2;
+ for (const r of [0.96, 0.78, 0.6, 0.42, 0.24]) { ctx.beginPath(); ctx.arc(c, c, c * r, 0, Math.PI * 2); ctx.stroke(); }
+ // Tick ring on the rim.
+ for (let i = 0; i < 120; i += 1) {
+ const a = (i / 120) * Math.PI * 2, long = i % 10 === 0;
+ const r0 = c * (long ? 0.86 : 0.9), r1 = c * 0.95;
+ ctx.lineWidth = long ? 3 : 1.4;
+ ctx.beginPath(); ctx.moveTo(c + Math.cos(a) * r0, c + Math.sin(a) * r0); ctx.lineTo(c + Math.cos(a) * r1, c + Math.sin(a) * r1); ctx.stroke();
+ }
+ // Thick arc segments, like gauges.
+ ctx.lineWidth = 9;
+ for (const [from, to, r] of [[0.1, 0.9, 0.69], [2.2, 3.4, 0.69], [4.1, 5.6, 0.51], [1.2, 1.9, 0.33]] as const) {
+ ctx.beginPath(); ctx.arc(c, c, c * r, from, to); ctx.stroke();
+ }
+ // Crosshair and diagonals.
+ ctx.lineWidth = 1.2;
+ ctx.globalAlpha = 0.55;
+ for (let i = 0; i < 4; i += 1) {
+ const a = (i / 4) * Math.PI;
+ ctx.beginPath(); ctx.moveTo(c + Math.cos(a) * c * 0.2, c + Math.sin(a) * c * 0.2); ctx.lineTo(c + Math.cos(a) * c * 0.96, c + Math.sin(a) * c * 0.96); ctx.stroke();
+ ctx.beginPath(); ctx.moveTo(c - Math.cos(a) * c * 0.2, c - Math.sin(a) * c * 0.2); ctx.lineTo(c - Math.cos(a) * c * 0.96, c - Math.sin(a) * c * 0.96); ctx.stroke();
+ }
+ ctx.globalAlpha = 1;
+ // Blips, a few in amber.
+ for (let i = 0; i < 14; i += 1) {
+ const a = i * 2.39, r = c * (0.3 + ((i * 37) % 60) / 100);
+ glow(ctx, i % 4 === 0 ? AMBER : ICE, 14);
+ ctx.beginPath(); ctx.arc(c + Math.cos(a) * r, c + Math.sin(a) * r, i % 4 === 0 ? 7 : 4, 0, Math.PI * 2); ctx.fill();
+ }
+}
+
+type PanelKind = "bars" | "wave" | "gauge" | "list" | "grid";
+
+/** One floating panel: a framed readout in cyan on glass. */
+function drawPanel(kind: PanelKind): (ctx: CanvasRenderingContext2D, w: number, h: number) => void {
+ return (ctx, w, h) => {
+ ctx.clearRect(0, 0, w, h);
+ ctx.fillStyle = "rgba(40, 190, 255, 0.22)";
+ ctx.fillRect(0, 0, w, h);
+ glow(ctx, CYAN, 8);
+ ctx.lineWidth = 3;
+ // Corner brackets instead of a full frame.
+ const k = 34;
+ for (const [x, y, dx, dy] of [[6, 6, 1, 1], [w - 6, 6, -1, 1], [6, h - 6, 1, -1], [w - 6, h - 6, -1, -1]] as const) {
+ ctx.beginPath(); ctx.moveTo(x, y + dy * k); ctx.lineTo(x, y); ctx.lineTo(x + dx * k, y); ctx.stroke();
+ }
+ ctx.lineWidth = 2;
+ ctx.fillRect(22, 22, w * 0.4, 7);
+ ctx.globalAlpha = 0.6;
+ ctx.fillRect(22, 36, w * 0.22, 4);
+ ctx.globalAlpha = 1;
+ const top = 58, bottom = h - 24, left = 24, right = w - 24;
+ if (kind === "bars") {
+ for (let i = 0; i < 12; i += 1) {
+ const bh = (bottom - top) * (0.25 + (((i * 53) % 70) / 100));
+ glow(ctx, i === 8 ? AMBER : CYAN, 8);
+ ctx.fillRect(left + i * ((right - left) / 12) + 3, bottom - bh, (right - left) / 12 - 8, bh);
+ }
+ } else if (kind === "wave") {
+ for (const [amp, phase, colour] of [[0.3, 0, CYAN], [0.18, 1.7, ICE], [0.1, 3.1, AMBER]] as const) {
+ glow(ctx, colour, 8);
+ ctx.beginPath();
+ for (let x = left; x <= right; x += 4) {
+ const y = (top + bottom) / 2 + Math.sin(x * 0.045 + phase) * (bottom - top) * amp + Math.sin(x * 0.13 + phase) * 6;
+ if (x === left) ctx.moveTo(x, y); else ctx.lineTo(x, y);
+ }
+ ctx.stroke();
+ }
+ } else if (kind === "gauge") {
+ const cx = w / 2, cy = (top + bottom) / 2 + 8, r = (bottom - top) / 2;
+ ctx.lineWidth = 12;
+ ctx.globalAlpha = 0.25;
+ ctx.beginPath(); ctx.arc(cx, cy, r, Math.PI * 0.8, Math.PI * 2.2); ctx.stroke();
+ ctx.globalAlpha = 1;
+ ctx.beginPath(); ctx.arc(cx, cy, r, Math.PI * 0.8, Math.PI * 1.85); ctx.stroke();
+ ctx.lineWidth = 3;
+ ctx.beginPath(); ctx.arc(cx, cy, r * 0.62, 0, Math.PI * 2); ctx.stroke();
+ glow(ctx, AMBER, 12);
+ ctx.beginPath(); ctx.arc(cx, cy, 8, 0, Math.PI * 2); ctx.fill();
+ } else if (kind === "list") {
+ for (let i = 0; i < 7; i += 1) {
+ const y = top + i * ((bottom - top) / 7);
+ glow(ctx, i === 2 ? AMBER : CYAN, 6);
+ ctx.fillRect(left, y, 10, 10);
+ ctx.globalAlpha = 0.85;
+ ctx.fillRect(left + 22, y + 2, (right - left - 40) * (0.35 + ((i * 29) % 55) / 100), 6);
+ ctx.globalAlpha = 1;
+ }
+ } else {
+ ctx.lineWidth = 1;
+ ctx.globalAlpha = 0.5;
+ for (let x = left; x <= right; x += 24) { ctx.beginPath(); ctx.moveTo(x, top); ctx.lineTo(x, bottom); ctx.stroke(); }
+ for (let y = top; y <= bottom; y += 24) { ctx.beginPath(); ctx.moveTo(left, y); ctx.lineTo(right, y); ctx.stroke(); }
+ ctx.globalAlpha = 1;
+ ctx.lineWidth = 3;
+ ctx.beginPath();
+ [[0.1, 0.8], [0.3, 0.55], [0.45, 0.62], [0.62, 0.3], [0.8, 0.38], [0.92, 0.15]].forEach(([fx, fy], i) => {
+ const x = left + (right - left) * fx, y = top + (bottom - top) * fy;
+ if (i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y);
+ });
+ ctx.stroke();
+ }
+ };
+}
+
+function holoMaterial(map: Texture | null, opacity = 0.9): MeshBasicMaterial {
+ return new MeshBasicMaterial({
+ map, color: map ? "#ffffff" : CYAN, transparent: true, opacity, side: DoubleSide,
+ depthWrite: false, blending: AdditiveBlending, toneMapped: false,
+ });
+}
+
+// ---------------------------------------------------------------------------
+// Shared geometry and materials.
+// ---------------------------------------------------------------------------
+
+const DECK_R = MISSION_DECK_RADIUS;
+const TABLE_R = MISSION_TABLE_RADIUS;
+const TABLE_Y = 0.92;
+const GLOBE_Y = 2.05;
const MM = {
- base: matte("#2b3446", { roughness: 0.55, metalness: 0.35 }),
- trim: matte("#1b2130", { roughness: 0.45, metalness: 0.4 }),
- body: matte("#dfe4ec", { roughness: 0.6 }),
- bezel: matte("#1f2533", { roughness: 0.5 }),
- screen: new MeshStandardMaterial({ color: "#0b1a2e", emissive: HOLO, emissiveIntensity: 0.45, roughness: 0.3 }),
- bar: new MeshStandardMaterial({ color: "#7dd3fc", emissive: "#7dd3fc", emissiveIntensity: 0.9 }),
- barWarm: new MeshStandardMaterial({ color: "#fbbf24", emissive: "#fbbf24", emissiveIntensity: 0.8 }),
- holo: new MeshStandardMaterial({ color: HOLO, emissive: HOLO, emissiveIntensity: 1.1, wireframe: true, transparent: true, opacity: 0.75 }),
- holoCore: new MeshStandardMaterial({ color: HOLO, emissive: HOLO, emissiveIntensity: 0.8, transparent: true, opacity: 0.18, depthWrite: false }),
- lens: new MeshStandardMaterial({ color: "#bae6fd", emissive: HOLO, emissiveIntensity: 1.4 }),
+ deck: new MeshStandardMaterial({ color: "#243044", roughness: 0.4, metalness: 0.55 }),
+ pedestal: new MeshStandardMaterial({ color: "#2a3549", roughness: 0.35, metalness: 0.6 }),
+ glass: new MeshStandardMaterial({ color: "#07101d", roughness: 0.12, metalness: 0.5, transparent: true, opacity: 0.88 }),
+ line: new MeshBasicMaterial({ color: CYAN, toneMapped: false }),
+ lineSoft: new MeshBasicMaterial({ color: CYAN, transparent: true, opacity: 0.45, toneMapped: false, depthWrite: false }),
+ column: new MeshBasicMaterial({ color: CYAN, transparent: true, opacity: 0.05, side: DoubleSide, depthWrite: false, blending: AdditiveBlending, toneMapped: false }),
+ globe: new MeshBasicMaterial({ color: CYAN, wireframe: true, transparent: true, opacity: 0.32, depthWrite: false, blending: AdditiveBlending, toneMapped: false }),
+ core: new MeshBasicMaterial({ color: "#0e6f8f", transparent: true, opacity: 0.12, depthWrite: false, blending: AdditiveBlending, toneMapped: false }),
+ orbit: new MeshBasicMaterial({ color: CYAN, transparent: true, opacity: 0.65, blending: AdditiveBlending, toneMapped: false }),
+ moon: new MeshBasicMaterial({ color: AMBER, toneMapped: false }),
+ sparks: new PointsMaterial({ color: CYAN, size: 0.03, transparent: true, opacity: 0.55, depthWrite: false, blending: AdditiveBlending, toneMapped: false }),
};
const GEO = {
- base: new CylinderGeometry(1.55, 1.58, 0.1, 48),
- ring: new CylinderGeometry(1.2, 1.2, 0.02, 48, 1, true),
- pillar: new CylinderGeometry(0.16, 0.22, 1.0, 20),
- lens: new CylinderGeometry(0.24, 0.24, 0.05, 24),
- globe: new SphereGeometry(0.46, 14, 10),
- core: new SphereGeometry(0.4, 20, 14),
- orbit: new TorusGeometry(0.62, 0.012, 6, 48),
+ deck: new CylinderGeometry(DECK_R, DECK_R + 0.04, 0.1, 64),
+ deckEdge: new TorusGeometry(DECK_R + 0.01, 0.018, 8, 96),
+ deckRing: new RingGeometry(TABLE_R + 0.12, TABLE_R + 0.15, 96),
+ pedestal: new CylinderGeometry(0.72, 0.95, TABLE_Y - 0.1, 48),
+ band: new TorusGeometry(0.8, 0.012, 6, 64),
+ table: new CylinderGeometry(TABLE_R, TABLE_R - 0.05, 0.06, 72),
+ tableRim: new TorusGeometry(TABLE_R, 0.022, 8, 96),
+ hud: new CircleGeometry(TABLE_R - 0.06, 72),
+ column: new CylinderGeometry(0.62, 0.36, GLOBE_Y - TABLE_Y - 0.35, 40, 1, true),
+ globe: new IcosahedronGeometry(0.55, 3),
+ core: new SphereGeometry(0.46, 24, 16),
+ orbitA: new TorusGeometry(0.78, 0.009, 6, 96),
+ orbitB: new TorusGeometry(0.9, 0.007, 6, 96),
+ orbitC: new TorusGeometry(1.0, 0.006, 6, 96),
+ moon: new SphereGeometry(0.045, 12, 8),
+ panel: new PlaneGeometry(0.9, 0.54),
};
-/** Consoles around the ring; each faces away from the centre, towards someone standing outside. */
-const CONSOLES = Array.from({ length: 6 }, (_, i) => (i * Math.PI) / 3 + Math.PI / 6);
-const CONSOLE_RADIUS = 1.08;
+/** Sparks drifting up through the deck, seeded so every load looks the same. */
+function sparkGeometry(): BufferGeometry {
+ const positions: number[] = [];
+ let seed = 7;
+ const rand = () => { seed = (seed * 16807) % 2147483647; return seed / 2147483647; };
+ for (let i = 0; i < 120; i += 1) {
+ // Kept out of the globe's middle so the sparks never pile up into a white blob.
+ const a = rand() * Math.PI * 2, r = 0.7 + rand() * (TABLE_R - 0.8);
+ positions.push(Math.cos(a) * r, TABLE_Y + 0.05 + rand() * 2.0, Math.sin(a) * r);
+ }
+ const geometry = new BufferGeometry();
+ geometry.setAttribute("position", new Float32BufferAttribute(positions, 3));
+ return geometry;
+}
-function Console({ angle }: { angle: number }) {
- // Local +z is the console's front; rotate so the front points outwards along `angle`.
- const x = Math.sin(angle) * CONSOLE_RADIUS;
- const z = Math.cos(angle) * CONSOLE_RADIUS;
- return (
- <group position={[x, 0, z]} rotation={[0, angle, 0]}>
- <Rounded size={[0.92, 0.78, 0.46]} radius={0.05} position={[0, 0.49, -0.02]} material={MM.body} />
- <Box size={[0.94, 0.04, 0.5]} position={[0, 0.9, 0]} material={MM.trim} />
- <group position={[0, 1.14, -0.08]} rotation={[-0.5, 0, 0]}>
- <Rounded size={[0.86, 0.5, 0.06]} radius={0.02} position={[0, 0, 0]} material={MM.bezel} />
- <Box size={[0.78, 0.42, 0.01]} position={[0, 0, 0.031]} material={MM.screen} cast={false} />
- {[-0.24, -0.12, 0, 0.12, 0.24].map((bx, i) => {
- const h = 0.08 + ((i * 37 + Math.round(angle * 10)) % 5) * 0.05;
- return <Box key={bx} size={[0.07, h, 0.004]} position={[bx, -0.18 + h / 2, 0.038]} material={i === 3 ? MM.barWarm : MM.bar} cast={false} />;
- })}
- </group>
- </group>
- );
+const PANELS: { kind: PanelKind; angle: number; y: number }[] = [
+ { kind: "bars", angle: 0, y: 1.5 },
+ { kind: "wave", angle: (Math.PI * 2) / 6, y: 1.62 },
+ { kind: "gauge", angle: (Math.PI * 4) / 6, y: 1.45 },
+ { kind: "list", angle: Math.PI, y: 1.58 },
+ { kind: "grid", angle: (Math.PI * 8) / 6, y: 1.48 },
+ { kind: "wave", angle: (Math.PI * 10) / 6, y: 1.6 },
+];
+const PANEL_RADIUS = 1.3;
+
+// ---------------------------------------------------------------------------
+// The deck.
+// ---------------------------------------------------------------------------
+
+function useHoloMaterials() {
+ return useMemo(() => ({
+ hud: holoMaterial(cachedCanvasTexture("mission:hud", 512, 512, drawTableHud), 0.95),
+ panels: PANELS.map((p, i) => holoMaterial(cachedCanvasTexture(`mission:panel:${p.kind}:${i % 2}`, 384, 232, drawPanel(p.kind)), 0.85)),
+ }), []);
}
-function Hologram() {
- const spin = useRef<Group>(null);
+export function MissionConsole() {
const reduced = useReducedMotion() ?? false;
- useFrame((_, delta) => {
- if (reduced || !spin.current) return;
- spin.current.rotation.y += delta * 0.35;
+ const holo = useHoloMaterials();
+ const sparks = useMemo(sparkGeometry, []);
+ useEffect(() => () => sparks.dispose(), [sparks]);
+ const globe = useRef<Group>(null);
+ const orbits = useRef<Group>(null);
+ const panels = useRef<Group>(null);
+ const drift = useRef<Group>(null);
+ const hovered = useRef(false);
+
+ useFrame(({ clock }, delta) => {
+ if (reduced) return;
+ const t = clock.elapsedTime;
+ if (globe.current) globe.current.rotation.y += delta * 0.3;
+ if (orbits.current) {
+ const [a, b, c] = orbits.current.children;
+ if (a) a.rotation.z += delta * 0.6;
+ if (b) b.rotation.z -= delta * 0.4;
+ if (c) c.rotation.z += delta * 0.25;
+ }
+ if (panels.current) {
+ panels.current.rotation.y += delta * 0.05;
+ panels.current.children.forEach((panel, i) => { panel.position.y = PANELS[i].y + Math.sin(t * 1.1 + i) * 0.04; });
+ }
+ if (drift.current) drift.current.rotation.y -= delta * 0.08;
});
+
+ useEffect(() => () => { if (hovered.current) document.body.style.cursor = ""; }, []);
+ const open = (event: ThreeEvent<MouseEvent>) => {
+ event.stopPropagation();
+ useOfficeStore.getState().select({ kind: "checkpoint", id: "mission" });
+ };
+ const over = (event: ThreeEvent<PointerEvent>) => { event.stopPropagation(); hovered.current = true; document.body.style.cursor = "pointer"; };
+ const out = () => { hovered.current = false; document.body.style.cursor = ""; };
+
return (
- <group position={[0, 1.68, 0]}>
- <group ref={spin}>
- <mesh geometry={GEO.globe} material={MM.holo} />
- <mesh geometry={GEO.orbit} material={MM.holo} rotation={[Math.PI / 2.6, 0, 0]} />
+ <group name="mission-deck" onClick={open} onPointerOver={over} onPointerOut={out}>
+ {/* Deck: a dark round platform with a glowing edge and a ring round the table. */}
+ <mesh geometry={GEO.deck} material={MM.deck} position={[0, 0.05, 0]} receiveShadow />
+ <mesh geometry={GEO.deckEdge} material={MM.line} position={[0, 0.1, 0]} rotation={[Math.PI / 2, 0, 0]} />
+ <mesh geometry={GEO.deckRing} material={MM.lineSoft} position={[0, 0.103, 0]} rotation={[-Math.PI / 2, 0, 0]} />
+
+ {/* Pedestal with light bands, glass table top, its rim and the HUD inside it. */}
+ <mesh geometry={GEO.pedestal} material={MM.pedestal} position={[0, 0.1 + (TABLE_Y - 0.1) / 2, 0]} castShadow />
+ {[0.3, 0.5, 0.7].map((y) => <mesh key={y} geometry={GEO.band} material={MM.line} position={[0, y, 0]} rotation={[Math.PI / 2, 0, 0]} scale={1 - y * 0.12} />)}
+ <mesh geometry={GEO.table} material={MM.glass} position={[0, TABLE_Y, 0]} castShadow receiveShadow />
+ <mesh geometry={GEO.tableRim} material={MM.line} position={[0, TABLE_Y + 0.03, 0]} rotation={[Math.PI / 2, 0, 0]} />
+ <mesh geometry={GEO.hud} material={holo.hud} position={[0, TABLE_Y + 0.034, 0]} rotation={[-Math.PI / 2, 0, 0]} />
+
+ {/* Light column rising from the table into the globe. */}
+ <mesh geometry={GEO.column} material={MM.column} position={[0, TABLE_Y + 0.03 + (GLOBE_Y - TABLE_Y - 0.35) / 2, 0]} />
+
+ {/* Wireframe globe with a soft core, and three tilted orbit rings with moons. */}
+ <group position={[0, GLOBE_Y, 0]}>
+ <group ref={globe}>
+ <mesh geometry={GEO.globe} material={MM.globe} />
+ </group>
+ <mesh geometry={GEO.core} material={MM.core} />
+ <group ref={orbits}>
+ <group rotation={[Math.PI / 2.4, 0.3, 0]}>
+ <mesh geometry={GEO.orbitA} material={MM.orbit} />
+ <mesh geometry={GEO.moon} material={MM.moon} position={[0.78, 0, 0]} />
+ </group>
+ <group rotation={[Math.PI / 1.8, -0.5, 0]}>
+ <mesh geometry={GEO.orbitB} material={MM.orbit} />
+ <mesh geometry={GEO.moon} material={MM.moon} position={[0, 0.9, 0]} />
+ </group>
+ <group rotation={[Math.PI / 2, 0, 0.9]}>
+ <mesh geometry={GEO.orbitC} material={MM.orbit} />
+ </group>
+ </group>
</group>
- <mesh geometry={GEO.core} material={MM.holoCore} />
- </group>
- );
-}
-/** The whole hub: base disc, glowing floor ring, six consoles, the projector and its globe. */
-export function MissionConsole() {
- return (
- <group>
- <mesh geometry={GEO.base} material={MM.base} position={[0, 0.05, 0]} receiveShadow />
- <mesh geometry={GEO.ring} material={MM.lens} position={[0, 0.105, 0]} />
- {CONSOLES.map((angle) => <Console key={angle} angle={angle} />)}
- <mesh geometry={GEO.pillar} material={MM.trim} position={[0, 0.6, 0]} castShadow />
- <mesh geometry={GEO.lens} material={MM.lens} position={[0, 1.12, 0]} />
- <Hologram />
+ {/* Floating readouts all the way round, facing outwards, drifting slowly. */}
+ <group ref={panels}>
+ {PANELS.map((p, i) => (
+ <group key={i} position={[Math.sin(p.angle) * PANEL_RADIUS, p.y, Math.cos(p.angle) * PANEL_RADIUS]} rotation={[0, p.angle, 0]}>
+ <mesh geometry={GEO.panel} material={holo.panels[i]} rotation={[-0.45, 0, 0]} />
+ </group>
+ ))}
+ </group>
+
+ <group ref={drift}>
+ <points geometry={sparks} material={MM.sparks} />
+ </group>
</group>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx
index 9d742eece7..0e5fd36914 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx
@@ -164,7 +164,10 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {
// Click-to-move / "walk there" requests.
if (store.walkTo && store.walkTo.seq !== lastWalk.current) {
lastWalk.current = store.walkTo.seq;
- player.path = findPath(grid, player, store.walkTo.point) ?? [];
+ // A target inside something solid (the middle of the holo deck) walks to the nearest free spot instead.
+ const goal = store.walkTo.point;
+ const free = isWalkable(grid, goal) ? null : nearestWalkable(grid, goal);
+ player.path = findPath(grid, player, goal) ?? (free ? findPath(grid, player, free) : null) ?? [];
}
// Keyboard movement, relative to where the camera looks.
let ix = 0, iz = 0;
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts
index 41ec108505..8b1ad57e57 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts
@@ -1,8 +1,9 @@
import { describe, expect, it } from "vitest";
import {
allDesks, archPosts, buildOfficeLayout, countStates, departmentKey, FURNITURE_SIZE, footprint, groupDepartments,
- MAX_DEPARTMENTS, MIN_DEPARTMENTS, type OfficeAgentInput,
+ MAX_DEPARTMENTS, MIN_DEPARTMENTS, MISSION_DECK_RADIUS, MISSION_REACH, missionDeckObstacles, type OfficeAgentInput,
} from "./officeLayout";
+import { buildNavGrid, isWalkable } from "./officeNav";
import { cameraHome, fitDistance, focusBounds } from "./officeCamera";
const agent = (id: string, provider: string, extra: Partial<OfficeAgentInput> = {}): OfficeAgentInput => ({
@@ -141,14 +142,38 @@ describe("office layout", () => {
expect(hub.x).toBe(0);
const depts = layout.departments;
expect(hub.z).toBeCloseTo((Math.min(...depts.map((d) => d.minZ)) + Math.max(...depts.map((d) => d.maxZ))) / 2);
- const box = footprint(hub);
- for (const dept of depts) expect(box.maxX < dept.minX || box.minX > dept.maxX).toBe(true);
- // The stop is in front of the console (south, towards the camera), outside its footprint.
- expect(stop.x).toBe(0);
- expect(stop.z - stop.radius).toBeGreaterThan(box.maxZ - 0.5);
+ // The whole ring the person can use from stays out of the departments.
+ for (const dept of depts) expect(stop.radius < Math.abs(dept.minX) && stop.radius < Math.abs(dept.maxX)).toBe(true);
expect(buildOfficeLayout([agent("a1", "codex")]).furniture.some((f) => f.kind === "missionConsole")).toBe(false);
});
+ it("makes the holo deck usable from every side, with a round collision and no invisible walls", () => {
+ const layout = buildOfficeLayout([agent("p1", "Personal Jarvis")], { variant: "coding" });
+ const hub = layout.furniture.find((f) => f.kind === "missionConsole")!;
+ const stop = layout.checkpoints.find((c) => c.id === "mission")!;
+ // The interaction ring is centred on the deck and reaches past its edge.
+ expect([stop.x, stop.z]).toEqual([hub.x, hub.z]);
+ expect(stop.radius).toBe(MISSION_DECK_RADIUS + MISSION_REACH);
+ // Collision never reaches beyond the lit deck (only the table is solid).
+ for (const r of missionDeckObstacles(hub)) {
+ for (const [x, z] of [[r.minX, r.minZ], [r.maxX, r.minZ], [r.minX, r.maxZ], [r.maxX, r.maxZ]]) {
+ expect(Math.hypot(x - hub.x, z - hub.z)).toBeLessThan(MISSION_DECK_RADIUS);
+ }
+ }
+ expect(FURNITURE_SIZE.missionConsole.solid).toBe(false);
+ // Standing on the deck's edge works all the way round, and each of those spots is inside the ring.
+ const grid = buildNavGrid(layout);
+ for (let i = 0; i < 16; i += 1) {
+ const a = (i / 16) * Math.PI * 2;
+ const p = { x: hub.x + Math.cos(a) * (MISSION_DECK_RADIUS + 0.2), z: hub.z + Math.sin(a) * (MISSION_DECK_RADIUS + 0.2) };
+ expect(isWalkable(grid, p)).toBe(true);
+ expect(Math.hypot(p.x - stop.x, p.z - stop.z)).toBeLessThanOrEqual(stop.radius);
+ }
+ // The table itself is solid; "walk there" goes to a free spot on the deck's edge.
+ expect(isWalkable(grid, { x: hub.x, z: hub.z })).toBe(false);
+ expect(isWalkable(grid, stop.approach!)).toBe(true);
+ });
+
it("counts states", () => {
expect(countStates([{ state: "working" }, { state: "idle" }, { state: "working" }])).toEqual({ working: 2, idle: 1, waiting: 0, paused: 0 });
});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
index 22b6458d74..73de8bf667 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
@@ -82,7 +82,18 @@ export interface WallSegment { x1: number; z1: number; x2: number; z2: number; r
export type CheckpointKind = "create" | "manage" | "team" | "wardrobe" | "lead" | "break" | "elevator" | "mission";
/** A place the person can walk to (or click from afar) to act. "floor" = the open office, outside every room. */
-export interface Checkpoint extends Point { id: CheckpointKind; room: RoomKind | "floor"; /** Walk-in radius in metres. */ radius: number }
+export interface Checkpoint extends Point {
+ id: CheckpointKind; room: RoomKind | "floor";
+ /** Walk-in radius in metres. */
+ radius: number;
+ /** Height of the floating token; absent = the standard height. Raised over tall props such as the holo deck. */
+ tokenY?: number;
+ /**
+ * Where "walk there" goes when the checkpoint's centre is inside something
+ * solid (the holo deck's ring is centred on its table); absent = the centre.
+ */
+ approach?: Point;
+}
export type FurnitureKind =
| "meetingTable" | "teamBoard" | "receptionDesk" | "kiosk" | "lockers" | "mirror"
@@ -127,7 +138,8 @@ export const FURNITURE_SIZE: Record<FurnitureKind, { w: number; d: number; h: nu
globe: { w: 0.92, d: 0.72, h: 1.2, solid: true },
floorLamp: { w: 0.46, d: 0.46, h: 1.8, solid: true },
dogBed: { w: 0.9, d: 0.72, h: 0.45, solid: true },
- missionConsole: { w: 3.2, d: 3.2, h: 2.2, solid: true },
+ // Round, so not a solid box: navigation walks around missionDeckObstacles instead.
+ missionConsole: { w: 3.9, d: 3.9, h: 3.1, solid: false },
};
export interface Furniture extends Point {
@@ -188,6 +200,30 @@ const DEPT_FOOTER_Z = 0.8;
const AISLE = 3.2;
/** The coding floor's centre aisle: wide enough for Mission Control with a walkway on both sides. */
export const MISSION_AISLE = 8;
+/** Mission Control's round deck and the command table standing on it (metres, from the deck centre). */
+export const MISSION_DECK_RADIUS = 1.9;
+export const MISSION_TABLE_RADIUS = 1.6;
+/** How far beyond the deck's edge the person can still use it. */
+export const MISSION_REACH = 1.2;
+
+/**
+ * What a walker bumps into at Mission Control: thin horizontal strips that
+ * trace the command table's circle (each as wide as the circle at its middle),
+ * so the collision is round like the table. The low deck platform around it
+ * stays walkable; nothing blocks the air beside the table.
+ */
+export function missionDeckObstacles(centre: Point, strips = 24): Rect[] {
+ const r = MISSION_TABLE_RADIUS;
+ const step = (2 * r) / strips;
+ const out: Rect[] = [];
+ for (let i = 0; i < strips; i += 1) {
+ const z0 = -r + step * i;
+ const mid = z0 + step / 2;
+ const half = Math.sqrt(r * r - mid * mid);
+ out.push({ minX: centre.x - half, maxX: centre.x + half, minZ: centre.z + z0, maxZ: centre.z + z0 + step });
+ }
+ return out;
+}
const EDGE = 1.6;
const NORTH_DEPTH = 7;
const SOUTH_DEPTH = 8;
@@ -499,8 +535,7 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options:
{ id: "break-shelf", kind: "bookshelf", x: bx0 + 2.2, z: bz0 + 0.3, rotationY: 0, room: "break" },
{ id: "break-plant", kind: "plant", x: bx0 + 0.6, z: bottomZ - 0.6, rotationY: 0, room: "break" },
...(coding ? [
- // Mission Control: the console ring on a round-cornered rug, midway down the centre aisle.
- { id: "mission-rug", kind: "rug", x: 0, z: missionZ, rotationY: 0, room: "floor", size: { w: 5.4, d: 5.4 } },
+ // Mission Control: the round holo deck, midway down the centre aisle.
{ id: "mission-console", kind: "missionConsole", x: 0, z: missionZ, rotationY: 0, room: "floor" },
] satisfies Furniture[] : []),
];
@@ -563,8 +598,9 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options:
// The elevator's doors face east into the lobby; its checkpoint is the floor in front of them.
const elevatorStop: Checkpoint = { id: "elevator", room: "reception", x: elevator.x + 0.95, z: elevator.z, radius: 1.0 };
const breakStop: Checkpoint = { id: "break", room: "break", x: bx0 + 5.6, z: bz0 + 2.6, radius: 1.8 };
- // Mission Control's stop is the console's south side, the side that faces the camera.
- const missionStop: Checkpoint = { id: "mission", room: "floor", x: 0, z: missionZ + FURNITURE_SIZE.missionConsole.d / 2 + 0.9, radius: 1.2 };
+ // Mission Control's stop is the whole deck: a ring round it, usable from every side.
+ const missionStop: Checkpoint = { id: "mission", room: "floor", x: 0, z: missionZ, radius: MISSION_DECK_RADIUS + MISSION_REACH, tokenY: 3.5,
+ approach: { x: 0, z: missionZ + MISSION_DECK_RADIUS + 0.3 } };
const checkpoints: Checkpoint[] = coding ? [missionStop, elevatorStop, breakStop] : [
{ id: "create", room: "reception", x: reception.x, z: reception.z + 1.7, radius: 1.2 },
{ id: "manage", room: "reception", x: kiosk.x, z: kiosk.z + 1.4, radius: 1.1 },
@@ -584,6 +620,7 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options:
// Department sign walls along each department's north edge.
...departments.map((d) => ({ minX: d.minX + 0.2, maxX: d.maxX - 0.2, minZ: d.minZ + 0.02, maxZ: d.minZ + 0.2 })),
...furniture.filter((f) => FURNITURE_SIZE[f.kind].solid).map(footprint),
+ ...(coding ? missionDeckObstacles({ x: 0, z: missionZ }) : []),
// The posts of an open room's name arch are solid too; nobody walks through them.
...rooms.filter((r) => !r.walled).flatMap(archPosts).map((p) => ({
minX: p.x - ARCH.post / 2, maxX: p.x + ARCH.post / 2, minZ: p.z - ARCH.post / 2, maxZ: p.z + ARCH.post / 2,
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.ts
index 8e15e7da93..ce3a87cf36 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.ts
@@ -16,7 +16,7 @@ function targetsOf(layout: OfficeLayout): { name: string; p: Point }[] {
return [
...allDesks(layout).flatMap((d) => [{ name: `seat ${d.id}`, p: seatOf(d) }, { name: `stand ${d.id}`, p: standOf(d) }]),
...layout.spots.map((s) => ({ name: `spot ${s.id}`, p: s })),
- ...layout.checkpoints.map((c) => ({ name: `checkpoint ${c.id}`, p: c })),
+ ...layout.checkpoints.map((c) => ({ name: `checkpoint ${c.id}`, p: c.approach ?? c })),
];
}