You must have something wrong in your code:
with this code:
var delayCreateScene = function () {
var scene = new BABYLON.Scene(engine);
const getParentSize = parent => {
const sizes = parent.getHierarchyBoundingVectors()
const size = {
x: sizes.max.x - sizes.min.x,
y: sizes.max.y - sizes.min.y,
z: sizes.max.z - sizes.min.z
}
return size
};
// The first parameter can be used to specify which mesh to import. Here we import all meshes
BABYLON.SceneLoader.Append("scenes/hochbeet/", "hochbeet.gltf", scene, function (newMeshes) {
scene.createDefaultCameraOrLight(true);
scene.activeCamera.attachControl(canvas, false);
scene.activeCamera.alpha += Math.PI; // camera +180°
let bv = scene.meshes[0].getHierarchyBoundingVectors();
let sz = getParentSize(scene.meshes[0]);
let box = new BABYLON.Mesh.CreateBox("box", 1, scene);
let mat = new BABYLON.StandardMaterial("mat", scene);
mat.alpha = 0;
box.material = mat;
box.scaling = new BABYLON.Vector3(sz.x, sz.y, sz.z);
box.position = new BABYLON.Vector3((bv.min.x + bv.max.x) / 2, (bv.min.y + bv.max.y) / 2, (bv.min.z + bv.max.z) / 2);
box.enableEdgesRendering();
box.edgesWidth = 40.0;
});
return scene;
}