I've encountered an interesting limit while using Orbit controls.
The zooming functionality is tied to the radius of the spherical coordinates of the camera in relation to the orbiting axis. Here's how it functions:
Whenever the user scrolls, the scale
value changes based on the zoom speed:
(if zooming in)
scale *= Math.pow(0.95, scope.zoomSpeed)
(or if zooming out)
scale /= Math.pow(0.95, scope.zoomSpeed)
Subsequently, the radius value is updated like this:
spherical.radius *= scale
Afterwards, the scale is reset to its default value
scale = 1
to prevent further changes to the radius
The spherical.radius
value dictates the proximity to the camera's focal point, creating a limit when zooming in due to the shrinking radius.
The issue arises when attempting to zoom in a direction where the spherical.radius
is at its minimum, making it impossible to zoom further.
Therefore, my query is about achieving the behavior of zooming up or down when at the radius limit using Orbit controls.
P.S. This code is located in OrbitControl.js
of the THREE.js
library, specifically within the this.update()
function. You can access the code on the github repo