Jump to content

Visibility problems loading GroundMesh on demand


Alvaro
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...