Positioning of Imported Objects

My motive is to replace the mesh which is imported from a GLTF file.

Everything works except for position.
The position of imported mesh is not same as that of the mesh that existed.

image
this is the orignal scene. I want to replace sink.

image
this is the imported mesh.

I tried using get and set absolute positions too.

Here’s the code:

var importedmeshposition = mesh3.getAbsolutePosition();
const resultPromise = BABYLON.SceneLoader.ImportMeshAsync("", meshobject.Filesrc, meshobject.Filename, scene);

// Result has meshes, particleSystems, skeletons, animationGroups and transformNodes

resultPromise.then((result) => {

    mesh3.dispose();

    importedmesh2 = result.meshes[0];

    importedmesh2.setAbsolutePosition(importedmeshposition);

    //        importedmesh2.position = importedmeshposition;

});

You wouldn’t have a PG to share? It’s hard to tell without the mesh or a PG.
I can still make a guess. Your axis(pivot) on your imported mesh is not placed at the center of your object and/or your object is not placed at zero (world) origin
Else, if it was, you would simply go something like:

importedmesh2.position = mesh3.position;

and your imported mesh would position at the same position than the other mesh.

1 Like

Hello @MG_Sharma just checking in, are you still having issues?