I have added camera animations in blender and the animation works perfect when run in blender. When I export the animation through glTF exporter, camera animation is exported but not animating.
While exporting I have checked ‘export camera’ option too.
Hm ok. If you’re checking “export camera” but not seeing cameras in that list, it sounds like something is going wrong during export and it’s not a three.js issue. If you can’t share your model, are you able to make a simpler example .blend with no private data that reproduces the problem?
I have attached a sample model where I have added a very basic camera animation.
Animation looks fine in blender but when I export it as glTF binary I don’t see any camera movement in https://gltf-viewer.donmccurdy.com/ . I do see ‘Cameras’ in upper right corner.
I guess I might be doing something wrong in belnder. Please have a look and let me know the issue.
@donmccurdy Did you get a chance to look at above sample models? If you need a detailed sample model than I can ask my design team to provide a better one.
My requirement is, the way camera animation is happening in blender same should happen when exported as .glb file.
What do you mean by “glTF camera animation”? Do you need for the camera to be embedded in the file? Or you want to control the camera using three.js, and view a glTF model? You may want to start a new thread and describe your question in more detail.
Hi Don, I have a .glb model with a baked camera animation from Cinema4D. I’m able to verify that the .glb file shows a “BakedCamera” in your .gltf viewer (it’s amazing!) and the camera animates perfectly.
I’m trying to take the baked camera animation and link it to a user’s scroll position on the browser (using Greensock). But first, I’d like the default three.js camera to switch to the embedded camera in .glb, how would I go about doing it? Thank you so much!
The default camera is whatever you pass into the render( scene, camera ) function. If you find a reference to the camera (get object by name, by traverse, etc.) you can use it there.
let camera;
gltf.scene.traverse((object) => {
if (object.isCamera) {
camera = object;
}
});