Slow pinch-zoom when using orthographic camera
Describe the bug
Using the pinch gesture to zoom the scene works great when using a perspective camera. If I use the gesture with an orthographic camera however, the camera moves very slowly, making the gesture pretty much unusable.
This is easily reproducible on mobile devices, I've tested it on both on iPad Pro 11 and an Android phone.
To Reproduce
Steps to reproduce the behavior:
- Launch the "orthographic" camera example on a mobile device
- Zoom using the pinch gesture
Code
No response
Live example
No response
Expected behavior
Should zoom at a reasonable speed even in orthographic mode.
Screenshots or Video
No response
Device
Mobile
OS
MacOS, Android
Browser
Chrome, Safari
Thank you for your report. The problem has been reproduced.
I will take a look, but sorry, I don't have much time at this moment. It may take some time.
Hi @yomotsu
I have been facing the same issue of zoom in ortho camera. Can you point me in a direction where I can take a look so that I can take a dig at this issue?
Regards Srinivas
Hi @yomotsu
Any help on this will be appreciated!
sorry for the loooooong delay... I checked the passed the delta value when internal zoom happens: https://github.com/yomotsu/camera-controls/blob/92ece6898f483e1f1844616a95ce0e839a48491f/src/CameraControls.ts#L3239
left is with a mouse wheel, and right is touch.
seems the value is not much different on both sides. but mouse wheel events happened more frequently if my investigation is correct...
What we could do is that:
Accelerate the delta a little bit, If the internalZoom is called from touch events.
(but not sure...
https://github.com/yomotsu/camera-controls/blob/92ece6898f483e1f1844616a95ce0e839a48491f/src/CameraControls.ts#L1165-L1200
Thanks @yomotsu :) Sorry for my late reply, ill take a look based on your inputs :) I appreciate your help on this!
This helped me fix it for mobile devices. But the same pinch zoom slowness is observed when using the trackpad to pinch zoom on laptops in the orthographic mode. What solution would you suggest ?
This should definitely be configurable by a factor provided by the user. Is there any way of fixing this currently? It's quite unusable right now.
After further testing, this issue is only affecting tablets and not smartphones.
After further testing, this issue is only affecting tablets and not smartphones.
Beg to differ. Pinch to zoom is sucking on my Google Pixel 8 Pro phone. 😢
Is there some way to override the pinching factor externally without forking the full project?
After further testing, this issue is only affecting tablets and not smartphones.
Beg to differ. Pinch to zoom is sucking on my Google Pixel 8 Pro phone. 😢
Is there some way to override the pinching factor externally without forking the full project?
Can't you just set cameraControls.minDistance and .maxDistance based on what kind of event is happening? That's what I've been doing.
EDIT: Actually, that seems to lead to stuttering when changing direction. Setting cameraControls.dollySpeed seems to work better.