-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: camera aspect #531
fix: camera aspect #531
Conversation
✅ Deploy Preview for tresjs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hey @andretchen0 great work here, thanks for the fix, if it's a breaking change, should we include it better on the v4 then? |
Thanks! v4 is fine with me. |
@andretchen0 Ok awesome, just change the base of the PR to the branch |
@andretchen0 something is off, there are too many changes that weren't related to your initial PR into v4 |
Thanks for flagging that. Merging in v4 seems to have added a lot of files to the PR. I'll close open a new PR that's based on v4 from the start. |
Warning
For current users of
<TresOrthographicCamera />
this is a breaking change. A solution is provided but requires intervention. See "Problem 2".Problem 1
Screen.Recording.2024-02-01.at.20.35.09.mov
Unlike
<TresPerspectiveCamera />
,<TresOrthographicCamera />
does not update automatically after screen ratio changes.StackBlitz
Solution
R3F uses the
Three.OrthographicCamera
's defaultleft, right, top, bottom
to maintain the frustum cuboid. This PR follows that example.Problem 2
Tres currently overwrites
aspect
on<TresPerspectiveCamera />
. In rare cases, the user may wish to controlaspect
.Similarly, with this PR,
left, right, top, bottom
on<TresOrthographicCamera />
are controlled by Tres. Users who set those attributes manually need a way to keep Tres from overwriting them.Solution
R3F lets users set a
manual
flag on the cameras to opt out of automatic aspect changes. This PR follows that example.To set a camera as "manual" in TypeScript:
Playground
Playground updated at /cameras/camera .
manual
cameras have been added.