aswzen
September 22, 2019, 3:18pm
1
Hi There,
How to limit zoom in and out when using THREE.OrbitControls, already tried with
controls.minDistance = 1;
controls.maxDistance = 2;
But have no luck, and i just tried it with
function update() {
if(camera.zoom >= 1.5){
camera.zoom = 1.5;
}
if(camera.zoom <= 0.5){
camera.zoom = 0.5;
}
}
But it looks like not smooth as well, i mean when you use android phone browser it will bounce when zoom touches the limit . try it.
Live implementation: http://asw.web.id/project/virtuviz
Any clue will be appreciated, thank you
Regards,
Git
Mugen87
September 22, 2019, 3:24pm
2
Instead of using OrbitControls.minDistance
and OrbitControls.maxDistance
(which is intended for perspective cameras), use OrbitControls.minZoom
and OrbitControls.maxZoom
.
3 Likes
aswzen
September 22, 2019, 3:32pm
3
looks i just implement your code in my app, the zoom got limited but somehow when i changed the value in min max i got the same results of zoom limit?
aswzen
September 22, 2019, 4:00pm
4
Got it, i just read the docs that minZoom and maxZoom value is float
https://threejs.org/docs/#examples/en/controls/OrbitControls.minZoom
2 Likes