Hi, I got this error “Argument of type ‘import(“babylonjs/scene”).Scene’ is not assignable to parameter of type ‘BABYLON.Scene’.” How can I fix it?
class Game {
private _scene: Scene;
private _canvas: HTMLCanvasElement;
private _engine: Engine;
constructor() {
this._canvas = this._createCanvas();
this._createScene();
this._example();
}
private _createCanvas() {
this._canvas = document.createElement('canvas');
this._canvas.style.width = '100%';
this._canvas.style.height = '100%';
this._canvas.id = 'gameCanvas';
document.body.appendChild(this._canvas);
return this._canvas;
}
private _createScene() {
this._engine = new Engine(this._canvas, true);
this._scene = new Scene(this._engine);
this._engine.runRenderLoop(() => {
this._scene.render();
});
window.addEventListener('resize', () => {
this._engine.resize();
});
}
private _example() {
let scene = new Scene(this._engine);
const camera = new BABYLON.ArcRotateCamera(
'camera',
-Math.PI / 2,
Math.PI / 2.5,
3,
new BABYLON.Vector3(0, 0, 0),
scene,
);
camera.attachControl(this._canvas, true);
const light = new BABYLON.HemisphericLight('light', new BABYLON.Vector3(0, 1, 0), scene);
const box = BABYLON.MeshBuilder.CreateBox('box', {});
}
}
new Game();