Issue on Loading GLTF files

Hi,

I tried to load the gltf models into my scene. using the CDN connection from the babylon documentation to achieve this.
But somehow only GLB models are loading into my scene, when i try the .GLTF its throwing an error.
Here is my code:

<script src="https://preview.babylonjs.com/gltf_validator.js"></script>
        <script src="https://preview.babylonjs.com/babylon.js"></script>
        <script src="https://cdn.babylonjs.com/babylon.js"></script>
        <script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>

 var building = BABYLON.SceneLoader.Append("./", "scene.gltf", scene, function (meshes) {    
            scene.createDefaultCameraOrLight(true, true, true); 
            }); 
            return scene;
      };

image

You are loading two different versions of babylon, which i assume is the reason behind the error. Try using one of them, and load the respective loaders javascript (for 4.2 from cdn, for 5.0 from preview)

2 Likes