the model is broken → check in other gltf viewers if they display it
url is wrong (check chrome devtools > networking tab) → fix the url
the model is too small → make it bigger
the model is too big, the camera is inside it → make it smaller
it is offset and/or doesn’t face the camera → center it
ps, adjustIslandScale is not reactive, i don’t see the purpose of that function, if window size changes the values won’t refresh. it imo wastes code over nothing. do this instead:
i an error saying it needs to be in canvas component, i put it in and still get error, then copy and paste code into chatgpt and it says it should work
ok i am mega confused. im in the canvas i wrote your code, i’ve tried chatgpt and here is the result, yes i know it is wrong, i only want to see the 3d model on the website
import { Suspense } from 'react'
import { Canvas, useThree } from "@react-three/fiber"
import Loader from "../components/Loader.jsx"
//import Island from "../models/Island.jsx"
import Cube from "../models/Cube.jsx"
{/* <div className='absolute top-28 left-0 right-0 z-10 flex items-center justify-center'>
POPUP
</div> */}
const Home = () => {
const { size } = useThree();
const { width, height } = size;
return (
<section className='w-full h-screen relative'>
<Canvas // 3D Objects here
className='w-full h-screen relative'
camera={{ near: 0.1, far: 1000 }}
// closer than near and further than 1000 wont be rendered
>
<Suspense fallback={<Loader />}>
<directionalLight position={[1, 1, 1]} intensity={2} />
<ambientLight />
<pointLight />
<spotLight />
<hemisphereLight />
function CubeInCanvas() {
const size = useThree(state => state.size)
}
<Cube
scale={width < 768 ? 0.9 : 1}
position={[0, -6.5, -43]}
rotation={[0.1, 4.7, 0]}
/>
</Suspense>
</Canvas>
</section>
)
}
export default Home