Zoom in and out with limit

Hi people,

I started using Babylon.js 2 days ago and already in love with it. I wish to keep learning new things here.
I am currently creating an ArcRotateCamera() and I am able to rotate around along with zoom with mouse wheel. However I am not able to give a maximum limit for the zoom in/out functions separately. Is there a function to do this?

 // This creates a basic Babylon Scene object (non-mesh)
            var scene = new BABYLON.Scene(engine);
            // This creates and positions a free camera (non-mesh)
            var camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 2, Math.PI / 2, 5, BABYLON.Vector3.Zero(), scene);
            // This targets the camera to scene origin
            camera.setTarget(BABYLON.Vector3.Zero());
            // This attaches the camera to the canvas
            camera.attachControl(canvas, true);

            camera.lowerRadiusLimit = camera.upperRadiusLimit = camera.radius = 5;
1 Like

But this is exactly what you do with:
camera.lowerRadiusLimit = maxZoom (smallest dist you can look from);
camera.upperRadiusLimit = minZoom (highest dist you can look from);

1 Like

Is it possible to start the http with camera radius distance = 50?

This is the 4th parameter of you Camera constructor
new BABYLON.ArcRotateCamera(…, …, …, 50…

Unfortunately just by adding 50 it does not load. Since it is Vector3, I have to do something else?
Since I am also giving camera.setTarget(BABYLON.Vector3.Zero());, how do I change it to a numbered distance?

https://doc.babylonjs.com/api/classes/babylon.arcrotatecamera#constructor

The 4th param is the radius and a number which is the distance from the target

1 Like