When implementing OrbitControls in ThreeJS, users can freely move the camera around. However, upon refreshing the model, the camera resets to its default position. I attempted to preserve the camera position and rotation using the code snippet below:
camera.position.x = lastPosX
...
...
camera.rotation.x = lastRotX
...
...
Despite my efforts, the result is not accurate and the view appears inverted and incorrect. I need to find a way to reproduce the exact view that users see when interacting with the camera using OrbitControls, even after refreshing the scene. What steps am I overlooking to achieve this?