I’m starting to create an app for vurtual tours of buildings, there are some great tutorials I’ve read but none specifically address my question; How can I extract multiple cameras from a glb/gltf and create them as babylon cameras which can be accessed through a UI?
The sanbox has this functionality, this is a file exported from Bledner with cameras set at specific positions, I’d like these to be exposed when the file is imported in BabylonJS.
I was looking for advice on how to expose the cameras from the glb file as cameras available in the UI. End goal is to creaet something like the sandbox which pulls out cameras/views in the glb as preset views in the sandbox UI.
Hmm, there seems to be a difference in how the playground and sandbox import cameras from a glb. This the from the sandbox, matches the exported glb from Blender:
I was just trying to add collisions and having this line in the code seems to make the scene respect the original camera locations, new playground below. I’m not sure why this would happen?
This line is causing an error in your code (remember to check your console while writing code):
Which makes all the lines after it not execute. The “culprit” for the difference between the two is actually:
scene.activeCamera.parent = null;
on line 81. Your scene cameras are set up relative to their parents in the scene hierarchy (which you can check with the Inspector), so removing the parent will mess up their transformations.