dbawel Posted January 11, 2018 Share Posted January 11, 2018 Hello, I have a script due tomorrow morning, and have asked a question on a seperate post which is the ideal solution. The only other solution I could show have for tomorrow is to start the renderloop, load an OBJ, and then dispose of the scene - but then the scene needs to begin loading new meshes after it detects a new path and mesh in an array, and render without any client interaction. I can't figure out how to load several scenes - lets say 5 scenes - and load scene 1 for 30 seconds, destroy scene one, on destroy scene two loads on it's own, and this process continues until scene 5 is loaded and then disposed. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted January 12, 2018 Share Posted January 12, 2018 What happens if you do something like: var sceneArr = [s1,s2,s3,s4]; var activeScene = sceneArr[0]; var timeChunk = 30000; setTimeout(()=>{ activeScene.dispose(); activeScene = sceneArr[1]},timeChunk); setTimeout(()=>{ activeScene.dispose(); activeScene = sceneArr[2]},timeChunk*2); setTimeout(()=>{ activeScene.dispose(); activeScene = sceneArr[3]},timeChunk*3); engine.runRenderLoop(function () { // Register a render loop to repeatedly render the scene activeScene.render(); }); Might work... there is way better logic for this, bit this should be simple to understand. dbawel 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 12, 2018 Share Posted January 12, 2018 You might wish to keep one scene. All meshes for "scene 1" would have layermask of 1, "scene 2" layermask of 4, "scene 3" layermask of 8. If you added a point light on your camera (light follows camera) , and set the layermask of them for the scene to currently display, then the other "scenes" meshes would simply be in-active. Disposing of scenes could be disruptive. dbawel 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 12, 2018 Share Posted January 12, 2018 @dbawel, had to walk the dog before it got nasty. What I meant by camera light is: var light = new BABYLON.PointLight("cam-light", new BABYLON.Vector3(0, 0, 0), scene); light.intensity = 0.8; scene.beforeCameraRender = function () { // move the light to match where the camera is light.position = scene.activeCamera.position; light.rotation = scene.activeCamera.rotation; }; dbawel 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.