1
0
This commit is contained in:
2024-08-06 17:55:08 +09:00
parent d5d5838953
commit d46df3c003

View File

@ -55,6 +55,19 @@ const VRMModel: React.FC<ModelProps> = ({ url = "./models/ai.vrm", url_anim="./m
return vrm ? <primitive object={vrm.scene} /> : null; return vrm ? <primitive object={vrm.scene} /> : null;
}; };
interface ModelGlbProps {
url: string
position?: [number, number, number]
rotation?: [number, number, number]
scale?: number
}
const GlbModel: React.FC<ModelGlbProps> = ({ url = "./models/solar_system_animation.glb", position = [0, 0, 0], scale = 1, rotation = [0, 0, 0] }) => {
const { scene } = useGLTF(url)
scene.scale.setScalar(scale);
return <primitive object={scene} />
}
type GLTFResult = GLTF & { type GLTFResult = GLTF & {
nodes: { nodes: {
Object_2: THREE.Mesh Object_2: THREE.Mesh
@ -142,6 +155,7 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
return ( return (
<group {...props} dispose={null} ref={ref}> <group {...props} dispose={null} ref={ref}>
<VRMModel url={model_custom} url_anim={anim_custom} position={position_custom} scale={1}/> <VRMModel url={model_custom} url_anim={anim_custom} position={position_custom} scale={1}/>
{g === 'sun' && <GlbModel url="./models/solar-system.glb" scale={10} />}
<pointLight <pointLight
position={[0, 0, 0]} position={[0, 0, 0]}
ref={galaxyCenterLightRef} ref={galaxyCenterLightRef}