A way to automatically scale the camera so that the currently visible object(s) fill the viewport
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Setting up a camera to give a "full picture" of an object while being agnostic to the object's size and shape can be somewhat tedious.
## What solution would you like?
This feature request was inspired by the VTK project, which has a [`ResetCamera()`](https://vtk.org/doc/nightly/html/classvtkRenderer.html#ae8055043e676defbbacff6f1ea65ad1e) function and `ResetCameraScreenSpace()`. This makes it very easy to load in a mesh, set an initial camera view, and then let VTK scale everything for you so that your object occupies most of the screen space, which is great for rendering previews of a model (i.e. exporting images of a model, implementing some kind of "showcase" functionality, etc.).
## What alternative(s) have you considered?
Implementing this myself by calculating the bounding box of the object(s) and setting scale appropriately.
## Additional context
Aforementioned link to VTK project.
Contributor guide
Research direction
Start by reading the linked VTK ResetCamera() and ResetCameraScreenSpace() behavior, then inspect Bevy's camera and viewport APIs. Define how currently visible objects are identified and how camera scaling should work for different object sizes and shapes. Done means a documented camera feature can frame visible objects to occupy most of the viewport.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100