Hi all, I am new to this forum.
I import a glb file, mesh in the imported scene the position coordinate seems to be different.
The redhouse is imported while I create a box, I set both mesh positions to (0,0,0), but it turns out they show in different positions. May I know how to fix it, so that all mesh shares the same position coordinate systems?
Welcome aboard!
The vertex coordinates of the tower are probably not centered around 0,0,0. You can either move the box so that it sits under the tower, or try to apply a translation to the vertices of the tower to center them around 0,0,0. Something like:
tower.refreshBoundingInfo();
const bb = tower.getBoundingInfo().boundingBox.centerWorld;
tower.position.set(-bb.x, -bb.y, -bb.z);
tower.bakeCurrentTransformIntoVertices();
Hi bro,
when I try
redhouse1.refreshBoundingInfo();
It pops up error as
babylon.js:16 BJS - [21:04:35]: Unable to load from src/scene/scene.glb: Error in onSuccess callback
We will need a repro in the Playground, it’s impossible to tell with just this line of code (check that redhouse1
is not null/undefined, though).
2 Likes