Hello everyone, Right now I am having an issue with loading a .babylon file to my vue-babylonjs scene. I`m not a professional, so I have to apologize in advance, if I’m not familiar with all aspects.
This is my code in my component. I also have the .babylon file within my components folder.
<template>
<div>
<canvas id="renderCanvas"></canvas>
</div>
</template>
export default {
import * as BABYLON from 'babylonjs'
import 'babylonjs-loaders'
data: function() {
return {
scene: null,
engine: null,
canvas: null,
mainCamera: null,
};
},
methods: {
init: function () {
const _this = this
this.canvas = document.getElementById("renderCanvas")
this.engine = new BABYLON.Engine(this.canvas, true)
this.scene = new BABYLON.Scene(this.engine)
this.mainCamera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 1.5, 1.3, 20, BABYLON.Vector3.Zero(), this.scene)
this.scene.beforeRender = function () {
}
this.engine.runRenderLoop(function () {
_this.scene.render()
})
BABYLON.SceneLoader.Append("./", "fox.babylon", this.scene, function (scene) {
});
},
mounted() {
this.init()
}
}
I also tried to load my .babylon file to sandbox, and it works fine.
But I get the following error message:
JS - [23:04:48]: Unable to load from /fox.babylon: importScene of undefined from undefined version: undefined, exporter version: undefinedimportScene has failed JSON parse e._ErrorEnabled @ webpack-internal:///./node_modules/babylonjs/babylon.js:16
In my network I get a 304 Error, initialized by babylon.js in line 16. I could add the code from that line here, but it is a few pages long so I’m not sure how useful that would be…
I really appreciate your time and would be happy if someone could help!