feat: restore WASD nav, improved plant geometry visibility
Some checks are pending
Deploy to Production / deploy (push) Waiting to run
Test / backend-test (push) Waiting to run
Test / frontend-test (push) Waiting to run

This commit is contained in:
fullsizemalt 2025-12-17 23:16:41 -08:00
parent fa67f2d271
commit 182e8c7d1a

View file

@ -114,8 +114,9 @@ function PlantInstances({ positions, onPlantClick, visMode }: {
} }
}} }}
> >
<cylinderGeometry args={[0.2, 0.1, 0.8, 8]} /> {/* Bushy Top */}
<meshStandardMaterial /> <dodecahedronGeometry args={[0.25, 0]} />
<meshStandardMaterial roughness={0.6} activeStripes={true} />
{plants.map((pos, i) => { {plants.map((pos, i) => {
let color = COLORS.VEG; let color = COLORS.VEG;
@ -138,11 +139,13 @@ function PlantInstances({ positions, onPlantClick, visMode }: {
break; break;
} }
// Lift plant slightly to sit ON shelf, not IN it
return ( return (
<Instance <Instance
key={pos.id || i} key={pos.id || i}
position={[pos.x, pos.y + 0.4, pos.z]} position={[pos.x, pos.y + 0.3, pos.z]}
color={color} color={color}
scale={[1.2, 1.2, 1.2]}
/> />
); );
})} })}
@ -189,6 +192,19 @@ function FacilityScene({ data, onSelectPlant, targetView, setControls, visMode }
} }
}, [targetView]); }, [targetView]);
// RESTORED: Keyboard Event Listeners for WASD
useEffect(() => {
const handleDown = (e: KeyboardEvent) => setKeysPressed(k => ({ ...k, [e.code]: true }));
const handleUp = (e: KeyboardEvent) => setKeysPressed(k => ({ ...k, [e.code]: false }));
window.addEventListener('keydown', handleDown);
window.addEventListener('keyup', handleUp);
return () => {
window.removeEventListener('keydown', handleDown);
window.removeEventListener('keyup', handleUp);
};
}, []);
useFrame((_, delta) => { useFrame((_, delta) => {
if (!controlsRef.current) return; if (!controlsRef.current) return;
const speed = 20 * delta; const speed = 20 * delta;
@ -310,8 +326,9 @@ function FacilityScene({ data, onSelectPlant, targetView, setControls, visMode }
castShadow castShadow
receiveShadow receiveShadow
> >
{/* Shelf - Lighter for visibility */}
<planeGeometry args={[section.width, section.height]} /> <planeGeometry args={[section.width, section.height]} />
<meshStandardMaterial color="#64748b" roughness={0.2} metalness={0.8} side={THREE.DoubleSide} /> <meshStandardMaterial color="#94a3b8" roughness={0.5} metalness={0.6} side={THREE.DoubleSide} />
</mesh> </mesh>
))} ))}
@ -365,7 +382,7 @@ function FacilityScene({ data, onSelectPlant, targetView, setControls, visMode }
return ( return (
<> <>
<Environment preset="city" background={false} /> <Environment preset="city" background={false} />
<ambientLight intensity={0.5} /> <ambientLight intensity={0.8} /> {/* Increased brightness */}
<directionalLight <directionalLight
position={[-10, 50, -10]} position={[-10, 50, -10]}
intensity={1} intensity={1}