donmccurdy / three-gltf-viewer

Drag-and-drop preview for glTF 2.0 models in WebGL using three.js.
https://gltf-viewer.donmccurdy.com/
MIT License
2.06k stars 530 forks source link

Default viewer camera zoom set incorrectly for animated asset #367

Open christianv78 opened 2 months ago

christianv78 commented 2 months ago

This took me close to an hour to figure out what was happening. I have an asset that is an explosion, and the 2 mesh objects scale from 0 to full sized, and then back to 0. But while I was seeing morphs animating in the side panel, I was not seeing anything in the 3D view. At least, not until I decided to try scaling from 0.001 instead of 0 - THEN I was able to see my mesh (in the first few frames).

Seems like you're setting the camera zoom based on the size of the objects on the first frame..? This means that my object that scales from 0.001 to 2.0 is completely out of frame throughout most of the animation, and I can't seem to zoom out.

I'd suggest either setting the camera view based on the maximum size of the object(s), or maybe just some kind of way to zoom waaay out. Maybe there is one but I can't find it.

I'd post the sample asset but it was originally purchased from Sketchfab, so I probably shouldn't. Let me know if you need more clarification.