I try to detect current zoom level ( or something like this ) in Three.js scene. I mean "zoom" (dolly) applied by mouse wheel action for example: simple scene contain : perspectiveCamera + orbitControl + object
1: `<= test is here
controls = new THREE.OrbitControls( camera );
controls.dollyOut = function(){ }
controls.dollyIn = function(){ }
controls.addEventListener('change', renderlog); ....`
TNX
When you are using a PerspectiveCamera
in combination with OrbitControls
, you have to be aware that "zooming" is not as a variable as it is with a orthographic camera. Instead "zooming" is done by just placing the camera closer to the target.
This means you can get the zoom distance by calculating the distance between the target and the camera position.
var zoom = controls.target.distanceTo( controls.object.position )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With