yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.

Home Page:https://yomotsu.github.io/camera-controls/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fitToBox doesn't work correctly when camera up vector is not (0, 1, 0)

smlntsv opened this issue · comments

commented

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:

  1. Go to provided example on codesandbox.io
  2. Click on fitToBox button, works correctly. Then change up vector to (1,0,0), click fitToBox again.
  3. 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