I am trying babylonjs in an angular app. I want to add multiple camera .But it is taking default camera always. Below I have shared my code screenshot

Hi , I am trying to add camera in the angular app with babylonjs . but it is always taking the default camera . I’m not able to set the camera.
initial Camera setup


Trying to change the camera conditionally but its not working!!

Any suggestion ?

Maybe you could share your code in the playground, which would be easier for you to help.

In your code I don’t see anything that allows you to define the camera that must be active.

Try adding this in your selectedKey conditions :
this.scene.activeCamera = this.camera;

you will need to dispose the old camera (important to prevent mem leaks), and set the new one to be the activeCamera. You are already attaching the new camera, so that’s good.

1 Like