-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Automatic camera transitions move twice as fast is a mouse button is down #68
Comments
Thanks for your report. I couldn't reproduce the problem. |
Interesting! I have uploaded a video of the issue on imgur: https://imgur.com/a/9yrUGqF The first time I didn't click the mouse button during the animation and the camera tweens at the intended speed. Then I hold my mouse button during the transition to show the camera speeding up, the third time I click intermittently. You can see when I'm holding the mouse button down as a little icon appears above the cursor in the screen recording. I'm seeing this issue on both latest chrome (79.0.3945.117) and firefox (72.0.1) on desktop, haven't tried on mobile. Thanks! |
Ah, I see. here is the problem.
However, there is no camera-move-end event to re-enable it for now. Here is an workaround.
|
Thanks! I had the feeling it was something going on on update. Weirdly enough, setting I looked into it a bit more, and found it that I am calling This actually resulted in another bug I had where re-enabling the controls afterwards would cause the camera to rotate even without clicking the mouse button, because it was still in the "stuck" state. I managed to fix this with a workaround, by calling |
@yomotsu I guess now you can use the cameraControls.fitTo( object, true );
cameraControls.enabled = false;
setTimeout( () => {
cameraControls.enabled = true;
}, 1000 ); Would become cameraControls.fitTo( object, true );
cameraControls.enabled = false;
cameraControls.addEventListener('rest', () => {
cameraControls.enabled = true;
}); Or even cameraControls.enabled = false;
await cameraControls.fitTo( object, true );
cameraControls.enabled = true; |
@looeee Oh yeah! That's right! Let me close this issue. |
Another workaround in case you still want to rotate the camera around during the zoom: const _prevDraggingDampingFactor = cameraControls.draggingDampingFactor;
cameraControls.draggingDampingFactor = cameraControls.dampingFactor;
await cameraControls.fitTo( object, true );
cameraControls.draggingDampingFactor = _prevDraggingDampingFactor; |
First of all, thanks for this very useful asset!
You can see the reported behaviour in the fit example: https://yomotsu.github.io/camera-controls/examples/fit-and-padding.html
Zoom out, then press one of the buttons to fit the camera view back to the box, and try clicking the mouse buttons. The transition speed definitely zooms in when a mouse button is held.
I have an app where I select 3D object with the mouse (raycasting) and fit the camera when they are clicked, but this bug causes the motion to be kinda jerky. Any way to fix this?
The text was updated successfully, but these errors were encountered: