I just had bring back a project with Babylon js inside and I’m a beginer on it. I have done several research on my problem but can’t find a good way to do it.
We use Babylon to create a container with several things placed in it. The generation is from a json in a dynamic call.
I would like to take 3 to 5 screenshots from different angle vision (front, side1, side 2, top for example). These could be done just on render if easier, but I need to store these screen automatically on a server or a cloud without asking the user to save it. I would manage the ‘if exists condition’ by myself.
I tried to create some new cameras after the scene.render() using CreateScreenshot and Babylon.ArcRotateCamera, but I always have a side screen of my render, and I have to validate the download each time.
var Scene = CreateScene(Solution, Canvas, Engine); var frontCam = new BABYLON.ArcRotateCamera("cameraF", -Math.PI / 2, Math.PI / 2, 0, new BABYLON.Vector3(0, 0, 0), Scene, false); var backCam = new BABYLON.ArcRotateCamera("cameraB", Math.PI / 2, Math.PI / 2, 30, new BABYLON.Vector3(0, 0, 0), Scene, false); var sideCam = new BABYLON.ArcRotateCamera("cameraC", 0, Math.PI, 0, new BABYLON.Vector3(0, 0, 0), Scene, false); BABYLON.Tools.CreateScreenshot(Engine, sideCam, 1600); BABYLON.Tools.CreateScreenshot(Engine, frontCam , 1600); BABYLON.Tools.CreateScreenshot(Engine, backCam, 1600);
I was thinking about “moving” the camera before each screen and use the scene.activeCamera but I"m not sure about the way to do it too.
What the best way to do it?
Thanks a lot for your help.