Problems entering new values in the camera

Hi, I am having problems updating the settings of the camera I have active.
This is the camera I have active:

function create360Camera() {
** const camera = new BABYLON.ArcRotateCamera(**
** “Camera360”,**
** 0,**
** 0,**
** 0.0001,**
** BABYLON.Vector3.Zero(),**
** window.scene**
** );**
** camera.lowerRadiusLimit = 0; // how far in can you zoom**
** camera.upperRadiusLimit = 0; // how far out can you zoom**
** camera.lowerAlphaLimit = 0; // how far in can you zoom**
** camera.inputs.attached.mousewheel.detachControl(canvasBJS);**
** camera.useNaturalPinchZoom = false;**
}

And here is an example method for changing the camera settings:

const camaraPlantaBaja = () => {

const camera = window.scene.getCameraByName(“Camera360”);
camera.alpha = 4.1;
camera.beta = 1.46;
camera.radius = 0.0001;
};

If I refresh the page the camera works, but if I run the method for the different views it does not always work.
Has this happened to anyone, any ideas?
Thank you very much for your help.

Well. First thing that comes to mind is this part.

image

You, limit camera radius to (0), so basically what this means is that you cannot go bellow or above 0 for radius. And then in your method you are setting radius to 0.0001 (weird number). Point is, you need to clear limits, then set the new value, and reintroduce the limits with the new value. So in your example, if you set radius to 10, it doesn’t matter, as camera has the rule, that you established, that radius cannot go bellow nor above 0, so it remains 0. Hopefully this makes sense.

Also lowerAlpha limit is not “how far in can you zoom”, but I will blame copy-paste for that :smiley:

If this is not the issue, then I would ask you to replicate the issue if possible in playground, so we can investigate it further.

For testing purposes, just clear limits completely, and test out your methods to see if camera works.

3 Likes

Hello @albaaaaagc5 just checking in if you’re still having issues?