Hi I’m trying to use drei cameracontrols to fit the scene to the boundingbox of my model on load like in camera-controls/examples/fit-and-padding.html at 8e62ca6fe347fa23e325266c587404dfe5b15854 · yomotsu/camera-controls · GitHub
I ported the code from the drei docs cameracontrols example and used useEffect but it says cameraControls.current is empty. also when I remove the fit to box use effect and use it normally, when I drag the control around and I click on the scene it seems to make the dragging stop. This is odd because it does not happen in the example codesandbox https://codesandbox.io/p/sandbox/cameracontrols-basic-sew669?
I also tried using alternatives such as wrapping
over my mesh
Like in the examples but it doesnt work on component load
https://codesandbox.io/p/sandbox/clones-42glz0?file=%2Fsrc%2FApp.js%3A36%2C1
I also tried adding a new orthographic camera but when I set it to makedefault I can probabbly adjust the zoom to show more of the model but im not sure on how I can set the width of the camera to only show the sides of the models boundingbox
Hoping for some help
project dl link
edit: it seems that the cameracontrols not working on useEffect was because when useEffect triggers the meshref isnt pointing to anything because the model is wrapped in the suspense component. though I am not currently sure how to refactor my code to make it work with suspense wrapped models