mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
193e8c4ada
# Objective glTF files can contain cameras. Currently the scene viewer example uses _a_ camera defined in the file if possible, otherwise it spawns a new one. It would be nice if instead it could load all the cameras and cycle through them, while also having a separate user-controller camera. ## Solution - instead of just a camera that is already defined, always spawn a new separate user-controller camera - maintain a list of loaded cameras and cycle through them (wrapping to the user-controller camera) when pressing `C` This matches the behavious that https://github.khronos.org/glTF-Sample-Viewer-Release/ has. ## Implementation notes - The gltf scene asset loader just spawns the cameras into the world, but does not return a mapping of camera index to bevy entity. So instead the scene_viewer example just collects all spawned cameras with a good old `query.iter().collect()`, so the order is unspecified and may change between runs. ## Demo https://user-images.githubusercontent.com/22177966/161826637-40161482-5b3b-4df5-aae8-1d5e9b918393.mp4 using the virtual city glTF sample file: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/VC Co-authored-by: Jakob Hellermann <hellermann@sipgate.de> |
||
---|---|---|
.. | ||
scene_viewer.rs |