Wrong location of model acquisition

This is the meshs absolute position of my project and his own position, obviously this position is wrong, how to get the position of the model in the camera coordinate space
image image

this is my camera position image

If I may ask (I might be missing something from the screenshots) - why is it obvious it is wrong?

Can you submit a playground so we can see the problem?

In general - absolute position is the world-coordinate location of the mesh. Seems like your mesh is not influenced by any parent, so this is the mesh’s position in the world. If the camera has a parent, its coordinates are subjected to the parents transformation. If not, the camera is also shown in world coordinates, and the information is totally correct.

No, I don’t think it’s true. My ground is 2 on the Y-axis, which is in the positive Y-axis, and my model is negative, which is not true

want to share a simple reproduction on the playgorund? this way we can all see what’s wrong. There are many factors to consider, and this way we can pinpoint an error (on your or our side) rather quick

unless your vertex data is off, you should be able to reproduce this using primitives. you can also upload the model somewhere that accepts CORS (github might be helpful) and load it on the playground (which supports that). If you cannot reproduce this using promitives, it might be the position vertex data

Awesome :slight_smile:
What are we looking at exactly? what is wrong?

My resources are all on git, but I can’t load PG, I will report an error

Hi @ranwei-001,
hopefully this doc page helps in allowing you to load your github hosted resources into a playground:

Sorry!I need you help!
There are two sets of models in my PG. When I select a set of models, they will be hidden together with the second set of models. This is not what I want. My purpose is to select which set of models to hide only the top of the selected model. model

Hmm…It looks like you were able to resolve your model acquisition issues, I’m not sure if this thread is the best place to discuss debugging your playground.

But looking at your playground, I can see that if we have two stacks of meshes: one consisting of floors 0-4, and another with floors 6-10.

I assume from your description that if we click on a mesh in any floor, we want to hide the meshes above the given floor? or just the meshes on the floor directly above the clicked floor?

Either way, for example if we click on floor 0, we hide every floor from 1-10, which hides our bunny structure. That doesn’t seem right. Do we just want to hide floor 1, or do we want to hide floors 1-4?

Either way, I suggest changing your data structure to separate your floors by structure

This is my PG, what I need is that I only want to hide the upper model of the selected floor, while the other floors do not hide


Yup, it seems like the same problem in this playground as well.

Look at how you initialize your floor[] structure at lines 159-171:

for(let i=0;i<JsonObject.length;i++){
            loadMesh=BABYLON.SceneLoader.ImportMeshAsync(null,JsonObject[i].url, JsonObject[i].filename, scene).then(
            function (result){
                let index=result.meshes.length-1;
                MeshMap[JsonObject[i].id] = result.meshes[index].parent;
                floor[i]=new BABYLON.TransformNode("floor"+i,scene);

You set all the loaded JSON objects to be in this array, even when they’re part of a different structure.

Then take a look at lines 243-245 of your playground when you disable the upper floors of the clicked floor:

for(let  i = _parent_level+1; i < floor.length; i++) {

you disable all json objects at an index greater than your clicked mesh, disabling meshes that are parts of other structures.

I think you need to rethink your datastructure used here to avoid this behavior.

I know there’s a problem here, but I’ve come up with a couple of solutions, collision detection, X-ray detection

  • Do you have a good solution? I have a big head:笑脸:


This is my PG, I have moved the camera to the target position to make it, but the model collision is hidden, I still can’t solve, the head is big!!Can you take a look at this for me? I have a big head:sweat_smile: