0

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.

Aasha joney
  • 508
  • 5
  • 23
  • Both `TrackballControls` and `OrbitControls` have `.minDistance` and `.maxDistance` properties. – prisoner849 Jan 09 '17 at 15:24
  • Trackball controls .minDistance and .maxDistance differs from orbit controls's property – Aasha joney Jan 10 '17 at 04:29
  • In trackball control it fails to limit zooming as it does in orbit controls.If you could do so,please provide me with a js fiddle. – Aasha joney Jan 10 '17 at 04:38
  • Nice demanding )) Could you show what you've done already or provide a js fiddle? For me, `.minDistance` and `.maxDistance` work as good as they meant to be. In both kinds of controls. – prisoner849 Jan 10 '17 at 07:18
  • controls = new THREE.OrbitControls(camera); controls.minZoom = 10; controls.maxZoom = 100; I used this in orbit control,it works fine but it didnt work for trackball controls in same case.it is initially setting the near and far value while loading – Aasha joney Jan 10 '17 at 07:27
  • Now it's more clear. TrackballControls don't have `.minZoom` and `.maxZoom` properties. – prisoner849 Jan 10 '17 at 07:37
  • In three version 70 they have only .minDistance and .maxDistance.In recent version FYI .minDistance and .maxDistance is for perspective camera and .minZoom and .maxZoom is for orthographic camera to limit zooming – Aasha joney Jan 10 '17 at 07:59
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/132761/discussion-between-prisoner849-and-aasha-joney). – prisoner849 Jan 10 '17 at 08:03

1 Answers1

0

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;
Aasha joney
  • 508
  • 5
  • 23