About acquiring model node and adding collision

these two days I found a problem, do the test of it is that I can’t give me the correct add collision model, before I add collision with engine own collision, I use importmeshAsync, into the model, he returned to the callback is a model, the result contains a root node and a child node, in general, I to add collision model, only need to add child nodes to go, but I found my node, the child node also contains the child nodes of the inside, then I found that is my texture testing, each texture has an ID,So when I load the model, the duplicate name generates the suffix name, but my problem now, I can’t get the node correctly, ,and I notice that I have added transformNode to the model, and the position of the model is distorted,I don’t know if it’s my spelling or the engine itself



this is my project

SceneLoader.prototype._InitGame=function(){
//加载模型的时候,先异步解析下是否有数据,如果有,则加载,反之则为空
(document).ready(function () { .ajax({
url:"…/Resources/Scene/data.js",
async:false,
error:function(){
return alert("!");
},
success:function(result_data){
JsonObject=eval(result_data);//读取数据,异步解析
for(let i=0;i<JsonObject.length;i++){
if(typeof(JsonObject[i].url)!=“undefined”&&(JsonObject[i].filename)!=“undefined”){
loadMesh=BABYLON.SceneLoader.ImportMeshAsync(null,JsonObject[i].url, JsonObject[i].filename, this.scene).then(
function (result){
var index=result.meshes.length-1;
result.meshes[index].showBoundingBox=true;
result.meshes[index].checkCollisions = true;
result.meshes[index].computeWorldMatrix(true);
console.log(i,index,result.meshes[index]);

                               // result.meshes[index].setAbsolutePosition(BABYLON.Vector3.Zero())
                                //通过数组存储每个对象本身的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];
                                   
                            //result.meshes[0].alwaysSelectAsActiveMesh=true;
                            //result.meshes[0].freezeWorldMatrix();  //冻结网格模型矩阵 
                        })
                   
                    }
                 
                }
                Promise.all([loadMesh]).then(() => { 
                    //当所有模型加载完成后,生成树
                    getTree(JsonObject,MeshMap); 
                    console.log("资源加载正常!"); 
                });  
            }});
        });
    }

Hi ranwei-001,

I’m struggling a bit to understand what problem you’re encountering. I think a Playground example might really help me understand more accurately.

In the absence of that, it sounds like the assets you’re importing have some redundant names, and that’s causing problems in fetching and colliding nodes. If that’s the problem, would the best way to address it be to remove the redundant names from the original assets? Or could you traverse the hierarchy after load to change the names so that they don’t collide?

Oh, okay. The problem is then that you’re able to click on things you don’t want actually want to select, right? If that’s the case and you can identify upfront which meshes you don’t want to select, could you set isPickable to false on those meshes?