Another Camera Question - ArcRotate Camera

I want to limit the behavior of the ArcRotate Camera - specifically limit the Beta value and Radius. In the past I have used code like this :

myScene.registerBeforeRender(function () {

if (myCamera2.beta < 1.57){
myCamera2.beta = 1.57;
}
else if (myCamera2.beta > (Math.PI / 2)){
myCamera2.beta = (Math.PI / 2);
}
});

That is code I got along time ago from @Dad72 - on the old forum. I also want to fix the radius which can be done the same way.

What I would like to know is if it is possible to set the camera once to just ignore changes to beta and radius without putting in the “myScene.registerBeforeRender” function ?

Stay Safe All, gryff :slight_smile:

You have the lowerXXXLimit/upperXXXLimit properties for the alpha/beta/radius properties:

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

3 Likes

TY @Evgeni_Popov : Will give it a try. (My poor coding skills showing up again :grinning: )

Update : Works like a charm. TY again @Evgeni_Popov :slight_smile:

Stay Safe, gryff :slight_smile:

1 Like