Yazheirx Posted October 24, 2018 Share Posted October 24, 2018 Due to my setup I am using the CDN link for BabylonJS. When I attempt to instantiate the GUI command I get a: [Error] TypeError: undefined is not an object (evaluating 'new BABYLON.GUI.GUI3DManager') createScene (ui.js:12) (anonymous function) (ui.js:24) <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>GC3 UI POC</title> <script src="https://cdn.babylonjs.com/babylon.max.js"></script> <style>#canvas { width:100%; height:100%; }</style> </head> <body> <canvas id="canvas"><script src="js/ui.js"></script></canvas> </body> </html> based on they following code: window.addEventListener('DOMContentLoaded', function(){ var canvas = document.getElementById('canvas'); var engine = new BABYLON.Engine(canvas, true); var createScene = function (){ var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color3.White(); var camera = new BABYLON.ArcRotateCamera('camera1', 0, 0, 10, new BABYLON.Vector3(0, 0, 0), scene); camera.setPosition(new BABYLON.Vector3(0,0,20)); camera.attachControl(canvas, true); var manager = new BABYLON.GUI.GUI3DManager(scene); /* var manager = new BABYLON.GUI.GUI3DManager(scene); var button1 = new BABYLON.GUI.HolographicButton("down"); manager.addControl(button1); button1.setPosition(new BABYLON.Vector3(10, 10, 0)); button1.text = "X"; */ var box = BABYLON.Mesh.CreateBox("Box", 4.0, scene); return scene; } var scene = createScene(); engine.runRenderLoop(function(){ scene.render(); }); }); Is there a different src file I should be including? Can I not use the GUI object when using the CDN src? Any help would be appreciated for this JS and Babylon newb. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 24, 2018 Share Posted October 24, 2018 Yes, you would need to add : <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script> You could also add pep.js to deal with inputs ? Quote Link to comment Share on other sites More sharing options...
Yazheirx Posted October 24, 2018 Author Share Posted October 24, 2018 Thank you that seems to have worked. I am past that error (on to the next several hundred ?) . I will have to look into pep.js as well. 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.