Prevent zoomout and prevent model from the flickering effect

I’m having 2 issues in my application.

1. Trouble controlling the zoom level of the camera. I want to avoid zoom-out completely and allow only a small amount of zoom-in. Amending the camera.upperRadiusLimit does not do what I need. It acts more like a the zoom level when the page loads.

var camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 2,  Math.PI / 4, 5, BABYLON.Vector3.Zero(), scene);

BABYLON.SceneLoader.AppendAsync("assets/model/", "sample.gltf", scene).then(function (scene) {
          scene.createDefaultCameraOrLight(true, true, true); 
          let camera = scene.activeCamera;
          camera.lowerRadiusLimit = 1;
          camera.upperRadiusLimit = 100;
          camera.attachControl(canvas, true);

2. I draw in to a canvas multiple times to change the texture dynamically. When the new text is being applied the model sort of has a flickering effect (happens ones for each texture change). Could someone suggest me how to prevent this so the new texture is being applied smoothly?

Hello! unfortunately for both questions we are going to need a repro in the playground to help

1 Like

Thanks @Deltakosh. I find it a bit difficult to repro it in the playground. Here I outlined the createScene() and the function used to change texture. I know this is not going to help much. Any suggestion would help.

While looking for solutions I came across the new BABYLON.FadeInOutBehavior() which may be a solution to hidethe flicker effect if done inside the change texture function?

You should not have any flicker at all. So this is why i would like a repro to understand what is going wrong :wink:

1 Like

Thanks and I understand @Deltakosh :slight_smile: BTW good to know about the flicker thing. So I’m doing something wrong somewhere.

1 Like