Hi there, I am new in threejs. I am using Vite + React + Typescript.
I’m using 2 Models. One is a House and the other is a Fish. Problem 1:
The House Is not showing. Here I tried so many ways to import but still not working.
The Fish model am using has animation. I mean the website I downloaded the model and there was animation. But now on my website there is no animation. Even when I try to console.log, I get empty object
const group = useRef<any>();
const { nodes, materials, animations } = useGLTF(
"./models/house/f1.glb"
) as GLTFResult;
const { actions } = useAnimations(animations, group);
// Here try to console the "actions" and get empty object
well, it says scale 0, so it’s invisible. you most likely used gltfjsx to make the model declarative. but in order to do that it must represent digits as text, if the model is really really small then 4 digits after the point aren’t enough. you can control that: npx gltfjsx model.glb --precision=6
you can also fix it in the model via blender.
actions is only valid in useEffect, the model does not exist yet when you log it out, in useEffect it exists and now you can log and play your animations.