here's my code
`import { OrbitControls } from "@react-three/drei";
import { DirectionalLight, PerspectiveCamera } from "three";
import { Canvas, useFrame } from "@react-three/fiber";
import { useState, useRef } from "react";
export default function Home() {
const [mosPos, setMosPos] = useState([0, 0]);
const Box = () => {
const mesh = useRef()
return (
<mesh position={[0, 0, 0]} ref={mesh}>
<boxGeometry args={[2, 2, 2, 5, 5, 5]} />
<meshStandardMaterial color={"hotpink"} />
</mesh>
);
};
const CameraHelper = () => {
const camera = new PerspectiveCamera(45, 1, 0.1, 1000);
return (
<group position={[0, 0, 10]}>
<cameraHelper args={[camera]} />
</group>
);
};
const Plan = () => {
return (
<mesh position={[0, -2, 0]} rotation={[Math.PI / 2, 0, 0]}>
<planeGeometry args={[10, 10]} />
<meshStandardMaterial color={"white"} />
</mesh>
);
};
const directionaligntProps = {
position: [0, 5, 2],
rotateX: Math.PI / 2,
rotateY: 0,
intensity: 10,
};
const LightHelper = () => {
const light = new DirectionalLight(0xffffff, 1);
return (
<group {...directionaligntProps}>
<directionalLightHelper args={[light]} />
</group>
);
};
return (
<div className="w-screen h-screen">
<Canvas
className="bg-black"
camera={{
fov: 45,
near: 0.1,
far: 1000,
position: [0, 0, 10],
}}
>
{/* <directionalLight /> /}
<ambientLight intensity={0.5} />
<directionalLight
{...directionaligntProps}
color={"white"}
castShadow
/>
<LightHelper />
<Box />
<Plan />
{/ <CameraHelper /> */}
<OrbitControls></OrbitControls>
</Canvas>
</div>
);
}
`