Hey, in my code I am trying to import from a .glb file and I am getting Uncaught TypeError: BABYLON.SceneLoader.LoadAssetContainer is not a function. I read the docs and took a look at some examples and I can’t see what I’m doing wrong here. Here is the code for the function I’m using to bring in the assets:
function createPlayer(scene, color, data) {
console.log('this works numero uno');
var bik;
// try {
BABYLON.SceneLoader.LoadAssetContainer("https://raw.githubusercontent.com/IMACULGY/Protron/master/assets/", "bike.glb", function (assets) {
//scene.createDefaultCameraOrLight(true, true, true);
console.log('this works');
var meshes = assets.meshes;
var mat = new BABYLON.StandardMaterial("mat", scene);
mat.diffuseColor = color;
mat.backFaceCulling = false;
for(var i = 0; i < meshes.length;i++)
{
meshes[i].material = mat;
}
bik = BABYLON.Mesh.MergeMeshes(meshes);
bik.scaling = new BABYLON.Vector3(0.5, 0.5, 0.5)
bik.layerMask = 2;
if (data) {
bik.position.y = data.y;
bik.position.x = -data.x;
bik.position.z = data.z;
bik.rotation.y = Math.PI
}
else {
bik.position.y = -1;
bik.position.x = 400;
bik.position.z = 0;
bik.rotation.y = 0
}
return bik;
});
Any help would be appreciated, thanks.