Hi everyone! can you help with the integration of Babylon.js in Nuxt app?) I created a simple page with this code. Haven’t console errors, but the image doesn’t appear on a page. canvas is just blank and white
I treid to follow this Getting Started - Chapter 1 - First Scene | Babylon.js Documentation
nuxt config js
{src: '~plugins/babylon.js', srr: false}
plugins/babylon.js:
import * as BABYLON from 'babylonjs';
import Vue from 'vue';
Vue.use(BABYLON);
in Vue file i get this code:
mounted() {
this.$nextTick(() => {
this.createScene();
}
);
},
methods: {
createScene() {
this.canvas = document.getElementById('renderCanvas');
this.engine = new BABYLON.Engine(this.canvas, true);
const scene = new BABYLON.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", {width:10, height: 10, depth: 10}, scene);
// return scene;
}
}
and pug part:
div.d-item
no-ssr
canvas#renderCanvas