RaananW Posted September 25, 2017 Share Posted September 25, 2017 Hello dear people, As already hinted in some other topics, I have finished the implementation of NPM packages for BabylonJS and its submodules. Starting babylonjs 3.1.0-alpha3.4 you can use NPM to include BabylonJS and its modules in both JavaScript and TypeScript projects. The available npm packages can be found here - https://www.npmjs.com/~babylonjs . Full usage is currently being documented, but here is a simple way to get started: First install the latest babylonjs npm install --save babylonjs babylonjs-gui babylonjs-materials then, use those modules in your JS/TS file: import * as BABYLON from 'babylonjs'; import 'babylonjs-materials'; import * as GUI from 'babylonjs-gui'; let engine = new BABYLON.Engine(.........) I will update here when the documentation will be ready. Arte, inteja, davrous and 5 others 6 2 Quote Link to comment Share on other sites More sharing options...
HeadClot Posted September 25, 2017 Share Posted September 25, 2017 YAY for full NPM support! Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 25, 2017 Author Share Posted September 25, 2017 Doc page is up - http://doc.babylonjs.com/overviews/npm_support . I will probably find a better solution for Oimo and Cannon integration. jerome and brianzinn 2 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 27, 2017 Share Posted September 27, 2017 I have tried out the GUI import and it works perfectly! So, really happy to have this working in my project I have a comment about the ES6 import. This comment is not related to importing for side-effects only (ie: import 'babylonjs-materials';). With "import * as GUI..." we would now do something like GUI.AdvancedDynamicTexture.CreateFullscreenUI("myUI"); instead of BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("myUI"); as per the documentation (and PGs). I wonder if it makes sense to unify both usages somehow and also for traditional BJS projects with <script src...> tags. It's obvious to me the usage, but I think it may confuse some people, whereas a framework should aim to guide down the path to success via simplicity/consistency. I've seen already some related questions in Q&A about namespaces and imports. Curious about your thoughts going forward as 3.1 is still in alpha. Thanks. RaananW 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted October 2, 2017 Share Posted October 2, 2017 @RaananW Can I use MeshBuilder.CreateBox on server-side? Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 2, 2017 Author Share Posted October 2, 2017 Hi @Arte, BabylonJS is currently not supported on server-side applications, mainly due to the many references to canvas and window (which are sadly missing on a regular node backend). The NPM support is more for wepack/browserify projects. We are considering a headless version of Babylon, which will allow you to use Babylon on your server. This will probably be done in future releases and not in 3.1. Arte 1 Quote Link to comment Share on other sites More sharing options...
Arte Posted October 2, 2017 Share Posted October 2, 2017 Ok I'm looking forward. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.