-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Restore CameraPosition after setOrbitPoint dosn't work #316
Comments
like const position = cameraControls.getPosition()
const target = cameraControls.getTarget()
const offset = cameraControls.getFocalOffset() then cameraControls.setOrbitPoint( 0, 0, 0, false )
cameraControls.setLookAt( position.x, position.y, position.z, target.x, target.y, target.z, false )
cameraControls.setFocalOffset( offset.x, offset.y, offset.z, false )
cameraControls.update( 0 ) (not tested tho) |
All right, I understand. Thanks for the answer and this great project! |
I also noticed that if the orbit point is set or changed for an orthographic camera. The DollyToCourser is no longer calculated correctly. I then zoom by an offset around the actual point. If I set the focalOffset to (0,0,0) it works normally again but the image then jumps once according to the offset. |
Actually, dolly-to-courser in Orthographic has a complex problem (dolly-to-courser for Orthographic should be removed until it's fixed, but keep it as it is for backward compat ) |
It would be cool if the dolly-to-courser with the rotate around mouse point would work. We would also like to offer our help to solve this problem, if that's ok? |
Absolutely! Also, would you mind elaborating "the dolly-to-courser with the rotate around mouse point"? |
With rotate-around-mouse-point I mean changing the orbit point (the camera rotates around the point of the cursor (mouse)). Currently there is the problem that when the orbit point (focal offset) is set or changed, the orthographic camera no longer zooms in the direction of the mouse cursor. The goal would be that, when changing the orbit point the orthographic camera zooms in the direction of the cursor. |
I think we must fix zoom-to-cursor in Orthographic Camera first then. |
The problem I mentioned right above ("zoom-to-cursor in orthographic camera is wrong") has just been fixed! |
Great, thank you very much. As soon as I have some time again I will try to get the focal offset with the orthographic camera. |
Describe the bug
I rotate the scene the mouse point, for this I set the current hitpoint of the raycaster at setOrbitPoint().
This also works perfectly.
Now I reset the camera occasionally to a saved position. These are determined with cameraControls.getPosition() and cameraControls.getTarget().
The resetting of this position does not work after I changed the OrbitPoint once. Even if I reset the OrbitPoint to (0,0,0), which I set as default position, the camera is not set to the saved position anymore.
Saving the camera state as JSON is unfortunately not possible, because other controllers may be used. Which do not offer this function.
To Reproduce
Store position with cameraControls.getPosition() and target with cameraControls.getTarget() in variable.
Move and rotate an object, setOrbitPoint() must be called once to change the OrbitPoint.
The previous saved position cannot be restored with cameraControls.setPosition(x,y,z) and cameraControls.setTarget(x,y,z,).
The saved position matches the current one, but the image is not the same anymore.
Code
Live example
https://yomotsu.github.io/camera-controls/examples/click-to-set-orbit-point.html
Expected behavior
Camera should return to the same position
Screenshots or Video
No response
Device
Desktop
OS
Windows
Browser
Chrome
The text was updated successfully, but these errors were encountered: