Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x 1x 1x 1x 1x | "use client";
import { useRef } from "react";
import { useFrame } from "@react-three/fiber";
import { useGLTF } from "@react-three/drei";
import * as THREE from "three";
interface ModelProps {
url: string;
scale?: number;
}
const CustomModel = ({ url, scale = 1 }: ModelProps) => {
const { scene } = useGLTF(url);
const modelRef = useRef<THREE.Group>(null);
useFrame(() => {
Eif (modelRef.current) {
modelRef.current.rotation.y += 0.002; // Slow rotation
}
});
return <primitive ref={modelRef} object={scene} scale={scale} />;
};
export default CustomModel;
|