Jump to content

Insert Babylonjs in the DOM with require.js


falsam
 Share

Recommended Posts

I use a web  programming language based on the Basic syntax. i know, it's stange. :ph34r:

The main purpose of this language is to allow development  windowed based web applications . It provides  commandset to handle GUI and 2D games.

The compiler generates html and  JavaScript files or packages for Android ans iOS

This programming language uses the Dojo.js and Pixi.js frameworks.

But  ... no features for 3D environment.

I have created a plugin that integrates the minimal features of babylonjs.

Example : Mesh = CreateBox(Name.s, Width.f, Height.f, Length.f)

I insert babylonjs in my plugin like this :

require( [ bjsenginepath + "/babylon.custom.js" ], ..

I have no probleme with the 3.1 version. But i have errors with the 3.2 Alpha.  

Quote

Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at __extends (babylon32.custom.js:1)
    at babylon32.custom.js:13755
    at BABYLON (babylon32.custom.js:13755)
    at babylon32.custom.js:13755

Thank you for your help.

 

Link to comment
Share on other sites

4 hours ago, Deltakosh said:

Can you share a page using 3.2?

Ooops sorry. I should have done it in my first message. 

First test.
Custom version 3.1.1(Cannon.js,  GUIObjSkyMaterialWater material) that I currently use. It's working.
http://falsam.com/sbbjs/basicscene.html

Second test.
CDN version 3.1.1 Version CDN 3.1.1. It's working. 
http://falsam.com/sbbjs/basicscene31CDN.html

Third test:
Custom version 3.2.0 AlphaB that generates the errors I copied in the previous comment. 
http://falsam.com/sbbjs/basicscene32.html

And finally this fourth test :
Version CDB 3.2.0 AlphaB that generates this error.
http://falsam.com/sbbjs/basicscene32CDN.html

Quote

Uncaught ReferenceError: BABYLON is not defined

Tested with Chrome and Edge

 

Link to comment
Share on other sites

For your fourth test, it seems like the babylonjs file is loaded too late.

For the other one, this is more complicated. I'll work on it

 

Link to comment
Share on other sites

  • 4 months later...

My problem is solved. 

I use the required function to load the babylon.js script.

With previous releases of babylon I did like this

require(["https://cdnjs.cloudflare.com/ajax/libs/babylonjs/3.0.0-alpha/babylon.js"]

  With the new version

require(["babylonjs", "https://cdnjs.cloudflare.com/ajax/libs/babylonjs/3.2.0/babylon.js"

Thanks for this excellent framework

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...