Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OrbitControls - Can I enable/disable zooming dynamically?

Tags:

three.js

I'm running Three.js r69 with the bundled OrbitControls.js. I have a simple scene with a couple of objects that are selectable. I'd like to be able to disable zooming while an object is selected and re-enable it once I've cleared the selection.

I'm working on a temporary solution, but it involves editing the OrbitControls.js code. This could make it really annoying to upgrade to a new version of Three.js, especially if OrbitControls is ever changed.

Is there currently a way to enable/disable certain features (like zooming, panning, or orbiting) on the fly, independently of each other?

like image 999
Justin Avatar asked Dec 10 '14 20:12

Justin


2 Answers

Is simple:

controls = new THREE.OrbitControls( camera );

// to disable zoom
controls.enableZoom = false;

// to disable rotation
controls.enableRotate = false;

// to disable pan
controls.enablePan = false;
like image 190
meirm Avatar answered Sep 20 '22 18:09

meirm


If you're editing the source you must have seen noZoom and noPan.

And this post shows how to constrain rotation.

Do these not meet your need?

like image 1
Bob Woodley Avatar answered Sep 24 '22 18:09

Bob Woodley