Babylon.js

Just starting out? Need help? Post your questions and find answers here.
falsam
Posts: 289
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

Babylon.js

Post by falsam »

Hello,
I am trying to integrate Babylon.js, but I get the following message:
C:\SpiderBasic Project\Babylon\test.sb:7 BABYLON is not defined
■ Small test code to initialize the 3D engine.

Code: Select all

HeaderSection
<meta name="description" content="babylon.js">
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<canvas id="renderCanvas"></canvas>
EndHeaderSection

EnableJS
const canvas = document.getElementById('renderCanvas');
console.log(canvas);

const engine = new BABYLON.Engine(canvas);
console.log(engine);
DisableJS

Thank for your help 🙏🌞

➽ Windows 11 - jdk-17.0 - SB 3.20 - Android 16
https://falsam.com

Sorry for my poor english
Dirk Geppert
Posts: 347
Joined: Fri Sep 22, 2017 7:02 am

Re: Babylon.js

Post by Dirk Geppert »

Unfortunately, HeaderSection inserts the code at the end of the head section.
For this to work correctly, you need the HtmlPreprocessor.

Code: Select all

HeaderSection
  <canvas id="renderCanvas"></canvas>
EndHeaderSection

;!  <HtmlPreprocessor>
;!    [
;!      {
;!        "search": "</title>",
;!        "replace": "</title>\n\n<meta name=\"description\" content=\"babylon.js\">\n<script src=\"https://cdn.babylonjs.com/babylon.js\"></script>"
;!      }
;!    ]
;!  </HtmlPreprocessor>

EnableJS
const canvas = document.getElementById('renderCanvas');
console.log(canvas);

const engine = new BABYLON.Engine(canvas);
console.log(engine);
DisableJS
Post Reply