Alvaro Posted January 8, 2015 Share Posted January 8, 2015 Hi Guys, I am building a system where I load tiles of a terrain by demand. Depending of where the camera is, I create new GroudMeshes as needed and tile it on the terrain. My Tiles are a json object with altitude data and some other values. I am facing a problem after loading the grounds. I cannot see any error and the grounds are loaded but they are "not visible" and depending of the angle of the camera they appear in the scene and disappear. They should also be checking collisions but they are not. I have a running example of my system, for simplicity I am always loading the same json but the control of the tiles and the rest are the same. https://dl.dropboxusercontent.com/u/63244599/CollisionsAndVisibility/CollisionsAndVisibility.html To see the problem just click on the link after loading try to move the camera arround (keep the same position) looking in a 20 degree down aprox. and You will see the ground, if you are lucky :S According with my testing, it seems to be something related with loading the meshes during the "before render" or "render" events. If I load all of them before start running the scene. It looks ok. I can also provide you with a zip file that includes the folder and all the files. Any ideas? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 9, 2015 Share Posted January 9, 2015 Sounds like bounding boxes are wrong. Can you try to display them? (mesh.showBoundingBox = true) If this is the problem, you can just ask mesh.computeWorldMatrix(true) to update them Quote Link to comment Share on other sites More sharing options...
Alvaro Posted January 10, 2015 Author Share Posted January 10, 2015 That fix it! thank You! And why exactly the bounding boxes were wrong? it is something I am doing wrong? Regards Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 10, 2015 Share Posted January 10, 2015 There is too much code to check but if you can reproduce the issue in the playground I can try to check that for you:) Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 13, 2015 Share Posted January 13, 2015 I experienced the same problem and found the cause (in my case, i guess it applies to yours as well).The problem is that the applyToMesh function of Geometry recreates the bounding info object, but without initializing the center of the Box or Sphere. So the objects were incorrectly located. I assume you either have a parent to all objects or use delayed loading. Already created a pull request - https://github.com/BabylonJS/Babylon.js/pull/359 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 13, 2015 Share Posted January 13, 2015 Validated 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.