Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: scroll-wheel camera zoom and a richer rover in OpenWorld exploration

Adam Eivy96808cad4796
diff --git a/client/src/components/openworld/OpenWorldHud.jsx b/client/src/components/openworld/OpenWorldHud.jsx
index 88cc4691f1..b93ff25ee7 100644
--- a/client/src/components/openworld/OpenWorldHud.jsx
+++ b/client/src/components/openworld/OpenWorldHud.jsx
@@ -45,7 +45,7 @@ function ControlsHint({ visible, isDesktop }) {
))}
</div>
<div className="font-pixel text-[8px] tracking-wide text-[rgb(var(--port-text-muted))]">
- WASD DRIVE <span className="mx-1 opacity-50">·</span> SHIFT BOOST <span className="mx-1 opacity-50">·</span> CTRL BRAKE <span className="mx-1 opacity-50">·</span> SPACE JUMP <span className="mx-1 opacity-50">·</span> M MAP
+ WASD DRIVE <span className="mx-1 opacity-50">·</span> SHIFT BOOST <span className="mx-1 opacity-50">·</span> CTRL BRAKE <span className="mx-1 opacity-50">·</span> SPACE JUMP <span className="mx-1 opacity-50">·</span> SCROLL ZOOM <span className="mx-1 opacity-50">·</span> M MAP
</div>
</div>
</div>
diff --git a/client/src/components/openworld/OpenWorldSettingsDrawer.jsx b/client/src/components/openworld/OpenWorldSettingsDrawer.jsx
index 507d07315e..71b2126d95 100644
--- a/client/src/components/openworld/OpenWorldSettingsDrawer.jsx
+++ b/client/src/components/openworld/OpenWorldSettingsDrawer.jsx
@@ -318,6 +318,7 @@ export default function OpenWorldSettingsDrawer({ open, onClose }) {
<ControlRow keys={['TAB']} label="Drop in / fly out" />
<ControlRow keys={['M']} label="World map" />
<ControlRow keys={['DRAG']} label="Look around" hint="Click the scene to capture the mouse" />
+ <ControlRow keys={['SCROLL']} label="Camera zoom" hint="Mouse wheel pulls the camera in / out" />
</div>
</div>
<button
diff --git a/client/src/components/openworld/PlayerAvatar.jsx b/client/src/components/openworld/PlayerAvatar.jsx
index 1bfabbab57..5a8d564162 100644
--- a/client/src/components/openworld/PlayerAvatar.jsx
+++ b/client/src/components/openworld/PlayerAvatar.jsx
@@ -17,7 +17,7 @@ const WHEEL_Z = CAR_LENGTH * 0.31;
const _rootTarget = new THREE.Vector3();
export default function PlayerAvatar({ rigRef }) {
- const { accent, surface } = useOpenWorldPalette();
+ const { accent, surface, isDay } = useOpenWorldPalette();
const rootRef = useRef();
const bodyRef = useRef();
const hoverRingRef = useRef();
@@ -31,6 +31,10 @@ export default function PlayerAvatar({ rigRef }) {
const bodyShadow = mixHex('#263447', accent, 0.16);
const glassColor = mixHex('#294765', accent, 0.22);
const wheelColor = '#17212d';
+ // Night driving readability: additive light cones project from the headlamps after
+ // dark (the palette's day flag doubles as the world's local time of day). Visual-only
+ // beams — no real light — keeps the rig free of per-frame shadow/light cost.
+ const headlightsOn = !isDay;
useFrame(({ clock }, delta) => {
const root = rootRef.current;
@@ -114,6 +118,38 @@ export default function PlayerAvatar({ rigRef }) {
<boxGeometry args={[CAR_WIDTH * 0.72, 0.26, CAR_LENGTH * 0.46]} />
<meshStandardMaterial {...surface} color={glassColor} roughness={0.24} metalness={0.36} transparent opacity={0.92} />
</mesh>
+ {/* Hood scoop breaks up the flat hood line and reads at speed. */}
+ <mesh position={[0, 0.72, -CAR_LENGTH * 0.16]}>
+ <boxGeometry args={[CAR_WIDTH * 0.26, 0.06, CAR_LENGTH * 0.16]} />
+ <meshStandardMaterial {...surface} color={bodyShadow} roughness={0.5} metalness={0.3} />
+ </mesh>
+ {/* Aero: front splitter + side skirts ground the body visually. */}
+ <mesh position={[0, 0.2, -CAR_LENGTH * 0.48]}>
+ <boxGeometry args={[CAR_WIDTH * 0.94, 0.05, 0.18]} />
+ <meshStandardMaterial color={wheelColor} roughness={0.85} metalness={0.1} />
+ </mesh>
+ {[-1, 1].map((side) => (
+ <mesh key={`skirt-${side}`} position={[side * (CAR_WIDTH / 2), 0.24, 0]}>
+ <boxGeometry args={[0.06, 0.13, CAR_LENGTH * 0.66]} />
+ <meshStandardMaterial color={wheelColor} roughness={0.85} metalness={0.1} />
+ </mesh>
+ ))}
+ {/* Rear wing on two struts — the silhouette cue that says "rover" from far away. */}
+ {[-1, 1].map((side) => (
+ <mesh key={`strut-${side}`} position={[side * CAR_WIDTH * 0.28, 0.76, CAR_LENGTH * 0.38]}>
+ <boxGeometry args={[0.05, 0.14, 0.07]} />
+ <meshStandardMaterial {...surface} color={bodyShadow} roughness={0.5} metalness={0.35} />
+ </mesh>
+ ))}
+ <mesh position={[0, 0.85, CAR_LENGTH * 0.4]}>
+ <boxGeometry args={[CAR_WIDTH * 1.04, 0.05, CAR_LENGTH * 0.13]} />
+ <meshStandardMaterial {...surface} color={bodyShadow} roughness={0.45} metalness={0.4} />
+ </mesh>
+ {/* Trailing accent strip along the wing's back edge. */}
+ <mesh position={[0, 0.85, CAR_LENGTH * 0.5]}>
+ <boxGeometry args={[CAR_WIDTH * 1.02, 0.03, 0.02]} />
+ <meshStandardMaterial color={accent} emissive={accent} emissiveIntensity={0.5} />
+ </mesh>
<mesh position={[0, 0.39, -CAR_LENGTH * 0.53]}>
<boxGeometry args={[CAR_WIDTH * 0.88, 0.08, 0.1]} />
<meshStandardMaterial color={accent} emissive={accent} emissiveIntensity={0.45} />
@@ -122,6 +158,35 @@ export default function PlayerAvatar({ rigRef }) {
<boxGeometry args={[CAR_WIDTH * 0.82, 0.07, 0.08]} />
<meshStandardMaterial color="#ef5252" emissive="#ef5252" emissiveIntensity={0.28} />
</mesh>
+ {/* Twin exhaust tips below the rear light bar. */}
+ {[-1, 1].map((side) => (
+ <mesh key={`exhaust-${side}`} position={[side * CAR_WIDTH * 0.18, 0.3, CAR_LENGTH * 0.54]} rotation={[Math.PI / 2, 0, 0]}>
+ <cylinderGeometry args={[0.045, 0.05, 0.09, 8]} />
+ <meshStandardMaterial color={bodyShadow} roughness={0.35} metalness={0.65} />
+ </mesh>
+ ))}
+
+ {/* Headlight beams after dark: apex at the lamp, cone spreading forward and a
+ touch down so the road ahead reads while driving at night. */}
+ {headlightsOn && [-1, 1].map((side) => (
+ <group key={`beam-${side}`} position={[side * CAR_WIDTH * 0.3, 0.55, -CAR_LENGTH * 0.55]} rotation={[-0.09, 0, 0]}>
+ {/* Cone axis is +Y by default; rotating +90° about X aims the apex
+ backward (+Z), so the mesh is offset half its height to plant the
+ apex on the lamp and spread the wide end out ahead of the rover. */}
+ <mesh rotation={[Math.PI / 2, 0, 0]} position={[0, 0, 2.7]}>
+ <coneGeometry args={[1.15, 5.4, 10, 1, true]} />
+ <meshBasicMaterial
+ color="#ffe9b8"
+ transparent
+ opacity={0.13}
+ blending={THREE.AdditiveBlending}
+ depthWrite={false}
+ side={THREE.DoubleSide}
+ toneMapped={false}
+ />
+ </mesh>
+ </group>
+ ))}
<group ref={thrusterRef} position={[0, 0.38, CAR_LENGTH * 0.58]} visible={false}>
{[-CAR_WIDTH * 0.24, CAR_WIDTH * 0.24].map((offsetX, i) => (
diff --git a/client/src/components/openworld/PlayerController.jsx b/client/src/components/openworld/PlayerController.jsx
index 3ffa2aef1c..376528e5ad 100644
--- a/client/src/components/openworld/PlayerController.jsx
+++ b/client/src/components/openworld/PlayerController.jsx
@@ -6,7 +6,7 @@ import useKeyCapture from '../../hooks/useKeyCapture';
import ErrorBoundary from '../ErrorBoundary';
import {
THIRD_PERSON, EYE_HEIGHT, DEFAULT_SPAWN_Z,
- thirdPersonCamera, resolveBoom,
+ thirdPersonCamera, resolveBoom, nextBoomZoom,
dampFactor, dampAngle, moveFacing, avatarState, bankAngle, stepVehicle,
moveWithCollisions, PLAYER_COLLISION_RADIUS, VEHICLE_COLLISION,
} from '../../utils/openWorldPlayerRig';
@@ -43,7 +43,8 @@ const _lookTarget = new THREE.Vector3();
// arcade vehicle handling, building-aware boom shortening, and speed-weighted steering.
// - 'first' (V to toggle): the classic invisible first-person camera.
// WASD/arrows, shift boost, E/Q vertical, F interact, R respawn, H horn, pointer-lock mouselook,
-// speed boost pads, cyber shards collection, landmark discovery, and world boundaries.
+// scroll-wheel camera zoom, speed boost pads, cyber shards collection, landmark discovery, and
+// world boundaries.
export default function PlayerController({
keysRef,
positions,
@@ -128,6 +129,10 @@ export default function PlayerController({
const poseTickRef = useRef(0);
const lastSpawnRef = useRef(null);
const pointerLockedRef = useRef(false);
+ // Camera boom zoom: `boomZoomTargetRef` is the player's chosen multiplier, `boomZoomRef`
+ // the smoothed value the camera actually uses this frame.
+ const boomZoomTargetRef = useRef(1);
+ const boomZoomRef = useRef(1);
useEffect(() => {
localCollectedSetRef.current = new Set(collectedShardIds);
@@ -232,6 +237,14 @@ export default function PlayerController({
rig.pitch = Math.max(-PITCH_LIMIT, Math.min(PITCH_LIMIT, rig.pitch));
}, [active]);
+ // Wheel zooms the third-person boom. Bound on the canvas (not window) so HUD panels
+ // and dialogs keep their own scroll; preventDefault stops any residual page scroll.
+ const handleWheel = useCallback((e) => {
+ if (!active) return;
+ e.preventDefault();
+ boomZoomTargetRef.current = nextBoomZoom(boomZoomTargetRef.current, e.deltaY);
+ }, [active]);
+
useEffect(() => {
if (!active) {
// Release pointer lock when leaving exploration mode
@@ -247,16 +260,18 @@ export default function PlayerController({
canvas.addEventListener('click', handleClick);
document.addEventListener('pointerlockchange', handlePointerLockChange);
document.addEventListener('mousemove', handleMouseMove);
+ canvas.addEventListener('wheel', handleWheel, { passive: false });
return () => {
canvas.removeEventListener('click', handleClick);
document.removeEventListener('pointerlockchange', handlePointerLockChange);
document.removeEventListener('mousemove', handleMouseMove);
+ canvas.removeEventListener('wheel', handleWheel);
if (document.pointerLockElement === canvas) {
document.exitPointerLock?.();
}
};
- }, [active, gl.domElement, handleClick, handlePointerLockChange, handleMouseMove]);
+ }, [active, gl.domElement, handleClick, handlePointerLockChange, handleMouseMove, handleWheel]);
// F interacts with the nearby target; V swaps first/third person; H plays horn; R returns to drop-in.
const interact = useCallback(() => {
@@ -564,12 +579,15 @@ export default function PlayerController({
return;
}
- // Third person: boom behind camera yaw
+ // Third person: boom behind camera yaw. The wheel multiplier eases toward its
+ // target so a fast scroll produces a smooth dolly instead of a jump cut.
+ boomZoomRef.current += (boomZoomTargetRef.current - boomZoomRef.current) * dampFactor(9, delta);
const desired = thirdPersonCamera({
pos: rig.position,
yaw: rig.yaw,
pitch: rig.pitch,
pitchOffset: THIRD_PERSON.isometricPitch,
+ boom: THIRD_PERSON.boom * boomZoomRef.current,
});
const anchor = { x: rig.position.x, y: rig.position.y + THIRD_PERSON.lookHeight, z: rig.position.z };
const { point: resolvedCam } = resolveBoom({ anchor, camera: desired.camera, buildings: buildingList });
diff --git a/client/src/utils/openWorldPlayerRig.js b/client/src/utils/openWorldPlayerRig.js
index 1b84ef63c3..599f1977a6 100644
--- a/client/src/utils/openWorldPlayerRig.js
+++ b/client/src/utils/openWorldPlayerRig.js
@@ -32,6 +32,18 @@ export const THIRD_PERSON = {
lookDampRate: 12, // aim smoothing (tighter than position so aim stays crisp)
};
+// Scroll-wheel boom zoom: a multiplier over THIRD_PERSON.boom. Steps are multiplicative
+// (exp of the wheel delta) so each notch feels equally sized at both ends of the range,
+// the way pinch-zoom does.
+export const BOOM_ZOOM = {
+ min: 0.45,
+ max: 2.1,
+ wheelRate: 0.0011, // exp factor per unit of WheelEvent.deltaY
+};
+
+export const nextBoomZoom = (current, deltaY) =>
+ Math.min(BOOM_ZOOM.max, Math.max(BOOM_ZOOM.min, current * Math.exp(deltaY * BOOM_ZOOM.wheelRate)));
+
// Arcade vehicle tuning for the default rover. It deliberately stops short of a full
// rigid-body simulation: OpenWorld needs a dependable, low-latency toy-car feel on a
// dashboard canvas, while still borrowing the important reference-game cues — ramped
diff --git a/client/src/utils/openWorldPlayerRig.test.js b/client/src/utils/openWorldPlayerRig.test.js
index 9d2d772055..e93b7113d6 100644
--- a/client/src/utils/openWorldPlayerRig.test.js
+++ b/client/src/utils/openWorldPlayerRig.test.js
@@ -1,12 +1,38 @@
import { describe, it, expect } from 'vitest';
import {
- THIRD_PERSON, clampPitch, thirdPersonCamera, resolveBoom,
+ THIRD_PERSON, BOOM_ZOOM, clampPitch, thirdPersonCamera, nextBoomZoom, resolveBoom,
dampFactor, dampAngle, moveFacing, avatarState, bankAngle, stepVehicle,
moveWithCollisions, VEHICLE_COLLISION,
} from './openWorldPlayerRig';
const pos = { x: 0, y: 1.6, z: 0 };
+describe('nextBoomZoom', () => {
+ it('zooms in for an upward wheel scroll and out for a downward one', () => {
+ const zoomIn = nextBoomZoom(1, -120);
+ const zoomOut = nextBoomZoom(1, 120);
+ expect(zoomIn).toBeLessThan(1);
+ expect(zoomOut).toBeGreaterThan(1);
+ });
+
+ it('is symmetric per notch — equal deltas move the multiplier equally in log space', () => {
+ const zoomIn = nextBoomZoom(1, -120);
+ const zoomOut = nextBoomZoom(1, 120);
+ expect(Math.log(zoomIn)).toBeCloseTo(-Math.log(zoomOut), 6);
+ });
+
+ it('clamps both ends so the boom never vanishes nor leaves the world scale', () => {
+ expect(nextBoomZoom(1, -1e9)).toBe(BOOM_ZOOM.min);
+ expect(nextBoomZoom(1, 1e9)).toBe(BOOM_ZOOM.max);
+ });
+
+ it('feeds thirdPersonCamera as a boom multiplier', () => {
+ const base = thirdPersonCamera({ pos, yaw: 0, pitch: 0 });
+ const close = thirdPersonCamera({ pos, yaw: 0, pitch: 0, boom: THIRD_PERSON.boom * BOOM_ZOOM.min });
+ expect(Math.abs(close.camera.z - pos.z)).toBeLessThan(Math.abs(base.camera.z - pos.z));
+ });
+});
+
describe('thirdPersonCamera', () => {
it('hangs the camera behind the character at yaw 0 (facing -Z → camera at +Z)', () => {
const { camera, lookAt } = thirdPersonCamera({ pos, yaw: 0, pitch: 0 });