Hi guys,
I’m trying to develop an interface in React with a custom babylon scene.
When i’m trying to load my custom scene with SceneLoader.Load() the console give me a "BJS - CANNON is not defined’
I have installed Cannon with npm
Here is my code for the component that load the scene :
import * as React from 'react';
import 'babylonjs-loaders';
import Scene from './component/Scene';
import {
SceneLoader,
} from "babylonjs";
export default class App extends React.Component {
onSceneMount = () => {
SceneLoader.Load("/scene/", "scene.babylon", this.engine, (scene) => {
this.scene = scene;
// No camera?
if (!this.scene.activeCamera) {
this.scene.createDefaultCamera(false, true, true);
}
// Attach camera
this.scene.activeCamera.attachControl(this.canvas, true);
this.engine.runRenderLoop(() => {
this.scene.render();
});
});
}
render() {
return (
<div>
<Scene onSceneMount={this.onSceneMount} />
</div>
)
}
}