import * as THREE from "three"; import { useRef, useState } from "react"; import { useFrame, GroupProps } from "@react-three/fiber"; import { RoundedBox } from "@react-three/drei"; /** * Component to draw rotating boxes. */ export default function RotatingBox(props: JSX.IntrinsicElements["mesh"]) { const mesh = useRef(null); // Track whether the boxes are hovered over and clicked const [hovered, setHover] = useState(false); const [active, setActive] = useState(false); // Rotate the meshes every animation frame useFrame(() => { mesh.current.rotation.y += 0.01; mesh.current.rotation.x += 0.01; }); return ( setActive(!active)} onPointerOver={() => setHover(true)} onPointerOut={() => setHover(false)} > ); }