fitToBox doesn't work correctly when camera up vector is not (0, 1, 0)
smlntsv opened this issue · comments
Describe the bug
After changing the camera up vector and calling updateCameraUp(), fitToBox stops working correctly.
Moreover, it works correctly with BoxGeometry and incorrectly with ExtrudeGeometry.
I prepared a small example to demonstrate this problem.
I found a workaround, but maybe this is the expected behavior?
To Reproduce
Steps to reproduce the behavior:
- Go to provided example on codesandbox.io
- Click on fitToBox button, works correctly. Then change up vector to (1,0,0), click fitToBox again.
- Make sure ExtrudeGeometry is selected as the mesh.
Code
No response
Live example
https://codesandbox.io/s/purple-https-423uz0?file=/src/App.tsx
Expected behavior
fitToBox should fit the viewport to the box
Screenshots or Video
No response
Device
Desktop
OS
No response
Browser
Chrome
Thanks for your report.
I reproduced the problem thanks to your working example and I just fixed it.
#391