Amir2020 Posted April 19, 2019 Share Posted April 19, 2019 Hi, I'm trying to get the width and height of the imported object in my scene, but I got this error. "Cannot read property 'getBoundingInfo' of undefined" and this is my code: var createScene = function(){ var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 2, Math.PI / 2, 4, BABYLON.Vector3.Zero(), scene); camera.attachControl(canvas, true); var front = BABYLON.SceneLoader.ImportMesh("", "model/", "front.glb", scene, function (meshes) { scene.createDefaultCameraOrLight(true, true, true); var light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 0, -50), this.scene); var light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 1, -1), this.scene); scene.executeWhenReady(function () { var camera = new BABYLON.ArcRotateCamera("camera", -Math.PI/2.1, 1.2, 45, new BABYLON.Vector3(4.85, -8.01, 3.93), scene); camera.attachControl(canvas, true); scene.activeCamera = camera; engine.runRenderLoop(function() { scene.render(); }); }); }); scene.createDefaultLight(); scene.clearColor = new BABYLON.Color4(0,0,0,0.0000000000000001); scene.ambientColor = new BABYLON.Color3(1, 1, 1); var size = front[0].getBoundingInfo().boundingBox.extendSize; console.log(size); return scene; }; Quote Link to comment Share on other sites More sharing options...
MarianG Posted April 22, 2019 Share Posted April 22, 2019 Hi @Amir2020. Please post your question here https://forum.babylonjs.com/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.