oschakravarthi Posted October 5, 2018 Share Posted October 5, 2018 Hi, When I do container.removeAllFromScene and container.addAllToScene, the cameras and lights should be maintained properly. But it is not happening. How can I achieve that? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 5, 2018 Share Posted October 5, 2018 Pinging @trevordev Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 5, 2018 Share Posted October 5, 2018 Hi guys, sorry to interrupt, but I MIGHT know a "dirty" way. http://playground.babylonjs.com/#YATDM6 Just include those top two functions... into your project... at the top (like that playground does). Scary kind of hacking. I didn't test it... but in theory, it MIGHT work... at least for a temporary solve. Keep in mind that this PERMANENTLY modifies the container's add-all and remove-all. You will need to MANUALLY default the code back to normal, if you need default ops, later. Sorry for the interrupt... back to wisdom and sanity, now. GameMonetize and trevordev 2 Quote Link to comment Share on other sites More sharing options...
trevordev Posted October 5, 2018 Share Posted October 5, 2018 @oschakravarthi see https://doc.babylonjs.com/how_to/how_to_use_assetcontainer , KeepAssets can be used to maintain objects when removing objects from the scene. When adding objects to the scene, you can inspect the scene.activeCamera and scene.lights and remove the ones that are not in your keep assets object. Quote Link to comment Share on other sites More sharing options...
oschakravarthi Posted October 6, 2018 Author Share Posted October 6, 2018 8 hours ago, trevordev said: @oschakravarthi see https://doc.babylonjs.com/how_to/how_to_use_assetcontainer , KeepAssets can be used to maintain objects when removing objects from the scene. When adding objects to the scene, you can inspect the scene.activeCamera and scene.lights and remove the ones that are not in your keep assets object. 1 Hi @trevordev Thanks a lot for your continuous support. So, we need to load all the assets before calling scene.createDefaultVRExperience(). If we load assets after instantiating scene.createDefaultVRExperience(), it causes a big problem. The VRExperienceHelper creates some cameras and adds them the scene. If we use moveAllFromScene, it will move all the cameras including those who are created by the VRExperienceHelper. It is the problem I am facing. So, you may ask for such a scenario where we load assets after entering VR mode. Scenario 1: Assume that we are in a VR game. We have our assets like Level1.babylon, Level2.babylon etc... in the server. While the user is playing and progressing, new levels will be loaded. Scenario 2: There is a Real estate application in which the user can explore various flats and projects in VR mode. There can be many scenarios like this. So, what I did? I have taken the source code of AssetContainer and commented the lines which add or remove cameras. It worked. As these scenarios are very valid, I request some more options in AssetContainer. Quote Link to comment Share on other sites More sharing options...
oschakravarthi Posted October 7, 2018 Author Share Posted October 7, 2018 On 10/6/2018 at 7:08 AM, oschakravarthi said: Hi @trevordev Thanks a lot for your continuous support. So, we need to load all the assets before calling scene.createDefaultVRExperience(). If we load assets after instantiating scene.createDefaultVRExperience(), it causes a big problem. The VRExperienceHelper creates some cameras and adds them the scene. If we use moveAllFromScene, it will move all the cameras including those who are created by the VRExperienceHelper. It is the problem I am facing. So, you may ask for such a scenario where we load assets after entering VR mode. Scenario 1: Assume that we are in a VR game. We have our assets like Level1.babylon, Level2.babylon etc... in the server. While the user is playing and progressing, new levels will be loaded. Scenario 2: There is a Real estate application in which the user can explore various flats and projects in VR mode. There can be many scenarios like this. So, what I did? I have taken the source code of AssetContainer and commented the lines which add or remove cameras. It worked. As these scenarios are very valid, I request some more options in AssetContainer. @ssaket, please look at this as well Quote Link to comment Share on other sites More sharing options...
ssaket Posted October 8, 2018 Share Posted October 8, 2018 @oschakravarthi I think this might be helpful for you - https://www.babylonjs-playground.com/#JA1ND3#48. you can have your levels in scene[] which you can query from your server and also can manipulate camera and light as per your need. I don't know much about VR Quote Link to comment Share on other sites More sharing options...
trevordev Posted October 8, 2018 Share Posted October 8, 2018 @oschakravarthi You shouldn't need to load all assets prior to entering vr. You just need to make sure that your assets to overwrite the active camera. You can load an asset container at any time and it shouldn't modify the scene until you call addAllToScene. What feature would you like to add? ssaket 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.