HoloLite

Getting error BABYLON.GUI.AdvancedDynamicTexture is undefined

Recommended Posts

Hello,

I was trying the http://playground.babylonjs.com/#E0WY4U#, demo and clicked the 'zip' button to save the source files.

I then tried to hit the saved pages using local webserver, but I was getting exception (see the attached file). 

The generated index.html (also attached here) has the following external references:

   <title>Babylon.js sample code</title>
        <!-- Babylon.js -->
        <script src="https://www.babylonjs.com/hand.minified-1.2.js"></script>
        <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
        <script src="https://preview.babylonjs.com/cannon.js"></script>
        <script src="https://preview.babylonjs.com/oimo.js"></script>
        <script src="https://preview.babylonjs.com/babylon.js"></script>


Looks like some GUI type is not defined, I guess the included gui.js is not correct ?

Please help. Thanks.

exception.png

index.html

Share this post


Link to post
Share on other sites

Hi @HoloLite 

Babylon GUI is an extention and must be included After the babylon.js file.
this is a bug in the sample download, a fix is on the way but for now just move babylon.js line above babylon.gui.js like shown below :) 

  <script src="https://www.babylonjs.com/hand.minified-1.2.js"></script>
+ <script src="https://preview.babylonjs.com/babylon.js"></script>
  <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
  <script src="https://preview.babylonjs.com/cannon.js"></script>
  <script src="https://preview.babylonjs.com/oimo.js"></script>
- <script src="https://preview.babylonjs.com/babylon.js"></script>

 

Share this post


Link to post
Share on other sites

404 means that the meshes aren't being loaded, but they are at that URL.  My guess is that it is CORS related or file:// policy.  You can get those meshes from github and put on your server:
https://github.com/BabylonJS/Babylon.js/tree/master/assets/meshes/controllers/microsoft/045E-065B

edit: WindowsMotionController.MODEL_BASE_URL So, at least when loading file://, I think you could do:

BABYLON.WindowsMotionController.MODEL_BASE_URL = '/myfolder/'

 

Share this post


Link to post
Share on other sites

@brianzinn thanks for the feedback.

I did try your suggestion. I copied the assets dir (including the meshes dir) onto my local web server. 

In my local web server's root directory, the file 'assets\meshes\controllers\microsoft\045E-065B\right.glb' or left glb actually exists.

Then I set:  

BABYLON.WindowsMotionController.MODEL_BASE_URL = "/assets/meshes/controllers/microsoft/";

But I am still getting the 404 error, even though the actual path to the .glb file actually exists. Any idea what went wrong ?

 

asset_error.png

Share this post


Link to post
Share on other sites

Hello!

This is because the Windows MR controllers are using glTF. It's also an extension you have to reference. I thought we had a warning message but apparently we didn't ;) cc @Deltakosh

In conclusion, to make my sample works on your machine you need :

- to download or reference our GUI extension library as it's not in the core of Babylon.js 

- to download or reference our glTF loader extension 

Thanks!

David 

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.