Skip to content

change the logic behind fitToBbox#22

Open
SameC137 wants to merge 2 commits into
vasturiano:masterfrom
SameC137:master
Open

change the logic behind fitToBbox#22
SameC137 wants to merge 2 commits into
vasturiano:masterfrom
SameC137:master

Conversation

@SameC137

Copy link
Copy Markdown

The old fitToBbox calculated fit distance using only the largest bbox half-extent from the world origin (center = (0,0,0)), which produced incorrect framing for off-center scenes and ignored the camera's current orientation.
The new implementation computes the geometric center of the bbox, extracts the camera's world-space right/up/forward axes and projects all 8 bbox corners onto the camera's view axes to compute the minimum required distance to fit both height and width and places the camera along its current forward direction (negated) from the center. I have kept the aspect the same though it is possible to fit on both axis with a recalculation of the aspect though it created weird renders and created a wonky effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant