Mesh adds bounding boxes

sorry!That said is not what I mean, I mean your examples, in scenes I use and the results have a problem, I don’t know if this problem is normal, my scene model is composed of a roof and wall, that is to say, when I click on the wall, he should also put all of the above models are hidden, but I try to do, he did not give my top to hidden, that is to say, he always have a layer of grid not hide, I don’t know why is this



when I click on the wall of floor one, it will hide my ground. I don’t know why

This is my video, and my project, you can look at it


http://120.78.84.216/

https://playground.babylonjs.com/#3VMTI9#124
this is my scenario initialization script, but because it is a class, the initialization scenario cannot be created


I don’t know why I create each node twice

Issue 1 In a playground urls cannot have relative addresses to external files but must be absolute addresses on a cors compliant server using https lines 54, 81, 113

Issue 2 Are all objects on different floors? There are 8 JSONObjects to load id 10 to id 18. This line 135 MeshMap[JsonObject[i].id].parent=floor[i]; puts each object on a new floor

Currently all mesh are separate, not a whole, ground – top – wall – top – wall in sequence from bottom to top. As for this level, why there are eight jsonobjects loading ID to Id18,I personally think it is my circulation problem, but he did not report an error, so I don’t know how to correct it



Because of the loop

for(var index=0;index<result.meshes.length;index++){
   result.meshes[index].checkCollisions = true;
   //result.meshes[index].showBoundingBox=true;
   result.meshes[1].computeWorldMatrix(true);
    //?????????????ID,????????mesh

   MeshMap[JsonObject[i].id] = result.meshes[index];  
   floor[i]=new BABYLON.TransformNode("floor"+i,this.scene);
   floor[i].level=i;
   floor[i].clicked=true;  
   MeshMap[JsonObject[i].id].parent=floor[i];
}

There is more than one mesh in each file, hence you set a floor for each mesh in the file though you only need to do so for result.meshes[1]

Provided each file contains only two meshes then using meshes[1] is good. When there are different numbers of meshes in each file you need to make sure you know which one you want.

Here is a simplified PG based on the one you gave 3VMTI9#124 https://www.babylonjs-playground.com/#MECK03#12

I had problems because the cat file contained three meshes.

You need to check the contents of each file for the number of meshes and make sure you are setting the parent on the correct one.


Thank you very much!I see you send my example, I had certain changes in their own projects, but I don’t know whether the father-son relationship problems, I put the two pictures below, the first one is I use BabylonJS inspector, modified, so it should be normal, click on metope, can hide, all the above grid, then the second picture is me in the scene test, the effect of top surface, not been hidden, he seems to be skipped this surface, and the inspector tree node as you can see, there are still a lot of the root node



This is my project and your project data, so I don’t know where the root nodes come from

They come from the file. I changed which index to use in result.mesh[index] because I knew which index my model was in the file. You need to check the index position of your model in your files and use the correct one.

The root meshes can come from the app that created the models and exported them.


OK, friend!According to what you said I change index, indeed he succeeded, but think about it, I have hundreds of models, to import to the scene, so I don’t have a will set up a correct ID, and, according to the sequence of loading, if my model ID is random, how to do it, for example I have stored inside a resource manager is all of my models, then I can come to drag them to the scene, so other people can’t be a drag in sequence, the ID is randomly changed, so in this case, this way will not be able to realize, after all, the need to make such a visual editor,The model ids will be generated randomly

The id is not important it is the number of meshes per file and the position of the model in the file. If all models were created and exported in the same way there should not be a problem.

https://www.babylonjs-playground.com/#1HH4OJ#32
I am now in the ID order he can hide model correctly, as you say change the position in the file of the model, but this is not good, because this function does not belong to private, everybody can use, if someone changed his order, so still can appear before I had problems, this way may not be very good, I think it’s best can use collision detection, click on the above model to detect whether there is a collision, if you have the choice of the hidden model, but you said before, no collisions occur under the static model, so I am very depressed, how should I improve the function

Are you saying that different users can put the models on different floors?

In theory, no one will put the model in a mess, but the index and location you just said to me should be correct, but this is a bad guarantee, and if I added two buildings to the scene of the scene, would he have hidden the other building

You are only importing a large but finite set of models so you will be able to find the index of each model in its file.

You should be able to find the location of a model after a user places it.

You may have to have the user connect models to a floor by having them create a floor and then link a model to a particular floor.



I’m depressed now, I changed a model, loaded out, crashed, added transformnode, dislocation of the model

Coding is never easy. There are always setbacks. Using what you have now learned consider each step one and a time and test it with a range of data. You will get there.



I see what you mean, but some things really hard to do it, now I am a novice, I found a problem, just seems to be the scene inspector shows that there are a lot of RootNode, when I create the TransformNode, and give me the model of the parent, can appear empty RootNode, this seems to be related to the TransformNode itself, still have even if, why my model after binding TransNode, there will be a model so far removed, another thing, can see my screenshot, some ID display is a model of the model,But some ids show names with suffixes, I don’t understand, in the same building

As well as your big project you need to do little tests. Write a separate routine that loads just one model and experiment with TransformNode and parents and child.

A new question on a new point. Please experiment with just one model.