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

fix: prevent camera from clipping below ground in exploration mode

Adam Eivy4d357179ee2a
diff --git a/client/src/components/city/PlayerController.jsx b/client/src/components/city/PlayerController.jsx
index 09085ec501..203dae3406 100644
--- a/client/src/components/city/PlayerController.jsx
+++ b/client/src/components/city/PlayerController.jsx
@@ -61,7 +61,7 @@ export default function PlayerController({
if (!pointerLockedRef.current || !active) return;
yawRef.current -= e.movementX * 0.002;
pitchRef.current += e.movementY * 0.002;
- pitchRef.current = Math.max(-0.4, Math.min(1.2, pitchRef.current));
+ pitchRef.current = Math.max(-0.1, Math.min(1.2, pitchRef.current));
}, [active]);
useEffect(() => {
@@ -184,9 +184,14 @@ export default function PlayerController({
// Camera follow - spherical offset from player
const camX = playerPos.current.x + Math.sin(yawRef.current) * Math.cos(pitchRef.current) * CAMERA_DISTANCE;
- const camY = playerPos.current.y + HEAD_HEIGHT + Math.sin(pitchRef.current) * CAMERA_DISTANCE;
+ const camY = Math.max(0.5, playerPos.current.y + HEAD_HEIGHT + Math.sin(pitchRef.current) * CAMERA_DISTANCE);
const camZ = playerPos.current.z + Math.cos(yawRef.current) * Math.cos(pitchRef.current) * CAMERA_DISTANCE;
+ // Ensure near plane is tight enough for street-level viewing
+ camera.near = 0.1;
+ camera.far = 500;
+ camera.updateProjectionMatrix();
+
const targetCamPos = new THREE.Vector3(camX, camY, camZ);
camera.position.lerp(targetCamPos, CAMERA_LERP);