Can I define the class of camera in a GLFT file for babylon to read?


I have a GLFT file that I create in some C++ code, and I am showing a sort of landscape, and I want to show the topdown view. So I could create a camera and babylonjs viewer shows it as camera0, so I can select it, so that works nicely!

However, I can only rotate that camera with the mouse, not zoom in or move around. For example in threejs there are the “mapcontrols” that work good for such landscapes, were you can move around with it, etc. I saw there are different classes of cameras available in babylonjs, but it’s always FreeCamera in case of imported GLFT cameras. Can I in my GLFT file also define the camera class that babylonjs should use?

I tried exporting some GLFT file from within babylonjs viewer, and exported all cameras, including the default one, which is a ArcRotateCamera. However, I found no special information about the type in the exported glft file. Even when I imported it again, i got a default camera node which was changed to the FreeCamera class under my scene node(and a new ArcRotateCamera default camera was made at the toplevel).

Best regards,

cc @bghgary ???

I guess you could use metadata or a custom extension to map to another camera type in babylon

No, this isn’t possible with the glTF format without a custom glTF extension. glTF loader always creates a FreeCamera right now. There will need to be custom metadata in the glTF and a custom glTF loader to make it so that you can select which camera to use. Or maybe we can add support for the glTF loader to create a different camera based on loader options.