I'm trying to find a good way to achieve a camera swap

I haven’t looked too much in how the engine will handle camera swapping I need to switch from the Universal camera that’s exported from a toolkit to a puzzle type camera that is fixed to an object that the user will interact with. What should be the way I go about doing this?

Hi.

Well, with my humble knowledge I believe that’s not an issue at all (performance-wise). On the coding side it is really simple.

You create both cameras and then you just switch active camera with some kind of button or whatever.

https://playground.babylonjs.com/#IS0JUM

You can see in the playground I’ve created two cameras (lines 7-8).
Attached both cameras to canvas (13-14)
And on the lines 17-18 you can see the method to set camera to active camera in the scene. Comment/Uncomment to see the difference between two active cameras. So you just create function that will control that behavior on the click of the button or whatever.

2 Likes