Loading files
05241c15dThis file is pinned to the selected release. Download the original to open it in your design tool.
"use client";
import { RoundedBox } from "@react-three/drei";
const BTN_COLORS = ["#34e7e4", "#ff3b3b", "#ffd23f", "#a855f7"]; // open / close / Z+ / Z-
/** A round arcade button — protrudes from the deck in the group's local +Z. */
function Button({ position, color }: { position: [number, number, number]; color: string }) {
return (
<mesh position={position} rotation={[Math.PI / 2, 0, 0]}>
<cylinderGeometry args={[0.075, 0.075, 0.06, 28]} />
<meshStandardMaterial
color={color}
emissive={color}
emissiveIntensity={1.2}
roughness={0.3}
metalness={0.1}
toneMapped={false}
/>
</mesh>
);
}
/**
* The cabinet's control gamepad rendered as 3D assets — a joystick and four buttons on a small angled
* deck. Purely aesthetic: the actual teleop lives in the DOM ControlBar, so this has no interaction or
* wiring (also keeps it clear of the clickable screen tiles / zoom handlers).
*/
export function ControlPad3D({
position,
rotation,
}: {
position: [number, number, number];
rotation?: [number, number, number];
}) {
return (
<group position={position} rotation={rotation}>
{/* control deck */}
<RoundedBox args={[1.7, 0.62, 0.14]} radius={0.05} smoothness={4}>
<meshStandardMaterial color="#0d1020" metalness={0.3} roughness={0.55} />
</RoundedBox>
{/* joystick (left) — base dish + shaft + glowing ball, all along local +Z */}
<group position={[-0.5, 0, 0.04]}>
<mesh rotation={[Math.PI / 2, 0, 0]}>
<cylinderGeometry args={[0.15, 0.18, 0.05, 32]} />
<meshStandardMaterial color="#0a0c18" metalness={0.5} roughness={0.4} />
</mesh>
<mesh position={[0, 0, 0.11]} rotation={[Math.PI / 2, 0, 0]}>
<cylinderGeometry args={[0.03, 0.04, 0.18, 16]} />
<meshStandardMaterial color="#9aa6c4" metalness={0.7} roughness={0.3} />
</mesh>
<mesh position={[0, 0, 0.22]}>
<sphereGeometry args={[0.085, 28, 28]} />
<meshStandardMaterial
color="#ff4fa3"
emissive="#ff4fa3"
emissiveIntensity={0.9}
roughness={0.25}
toneMapped={false}
/>
</mesh>
</group>
{/* four buttons (right), 2×2 */}
<Button position={[0.22, 0.14, 0.05]} color={BTN_COLORS[0]} />
<Button position={[0.5, 0.14, 0.05]} color={BTN_COLORS[1]} />
<Button position={[0.22, -0.14, 0.05]} color={BTN_COLORS[2]} />
<Button position={[0.5, -0.14, 0.05]} color={BTN_COLORS[3]} />
</group>
);
}