Search code examples
javascriptthree.jsmousewheelorbittrackball

THREE.js Limit Zooming in mousewheel event


Can anyone please tell me how to limit zooming in and out of an model in three.js. I came across trackball controls but there is no function or property to limit zooming.Tried using orbit controls also but when using along with trackball controls i could find some issues in rotation and panning.

Thanks in advance.


Solution

  • I was working with THREE.js version70 which doesn't support to limit zooming. In current THREE.js version 83 of Trackball controls we could limit the zooming in and out using the following code,

    controls.minDistance = 10;
    controls.maxDistance = 100;