Jump to content

TypeScript & Babylon.GUI Working Example


Kreeba
 Share

Recommended Posts

Hello. I apologies for multiple threads around the same issue, but I honestly feel very frustrated.

I am waiting for the NPM package of Babylon and Babylon.gui to be refactored to support moduler importing. Until then does anyone have a working example showing how to correctly reference Babylon and Babylon.GUI in a TypeScript project so it compiles and references correctly in the front end? I don't mind if it using CDN/Local Files/NPM anything, I will just adjust my code to match.

I have been stalled for around 3 weeks on this issue, and mostly am frustrated at myself for not having the technical skills to assist. TypeScript and Babylon are an excellent combination, however this technical area is still a 'black art' to me.

Any push in the right direction is very welcome.

Link to comment
Share on other sites

I just copied all the GUI files into my project and modified them.  It only took 15 minutes to modify the files.

At the top of ie: math2d.ts I have "import { Vector2, Epsilon } from 'babylonjs'" and then I removed the BABYLON. in the file itself.  It doesn't update obviously like an NPM, but no need to be stalled with an open source project.

Link to comment
Share on other sites

Thanks. I got it working. I basically stripped out all referencing and started again.

What worked for me was to do a /// reference in the source files to the Babylon typescript definitions so the IDE/TSC was happy. Then separately I used the online build tool to build a version of Babylon with GUI already in. Then linked that in the html container file. I will make a video later just to help anyone coming after me with the same issue.

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...