import { useFrame } from '@react-three/fiber'
import { useRef } from 'react'

function SolarSystem() {
    const orbitRef = useRef()

    useFrame((_, delta) => {
        orbitRef.current.rotation.y += delta * 0.8
    })

    return (
        <>
            <ambientLight intensity={0.2} />
            <pointLight position={[0, 0, 0]} intensity={50} />

        <mesh>
                <sphereGeometry args={[1, 32, 32]} />
                <meshStandardMaterial color="orange" emissive="orange" emissiveIntensity={2} />

                <group ref={orbitRef}>
                    <mesh position={[6, 0, 0]}>
                        <sphereGeometry args={[0.4, 32, 32]} />
                        <meshStandardMaterial color="royalblue" />
                    </mesh>
                </group>
            </mesh>
        </>
    )
}

export default SolarSystem