ReactJS error ImportMesh

Hi body. I getting the follow error.
I use Babylon.js v6.25.0 - WebGL2 and my BJS project run ok in all other parts, but when i try to load / import an external ojbect like glb or gltf I get up the next error.

The url of the assets in ok. I searched on “google” but no solution go up. I can help me any one?

I use import “@babylonjs/loaders/glTF”;

thanks in advanced

BJS - [15:03:22]: Unable to load from https://s3.eu-south-1.amazonaws.com/ai-assets-storage/system/resources/objects/01H668K63F9TSMDJ3TXR1MVNRB/scene.gltf: _this3._babylonScene._forceBlockMaterialDirtyMechanism is not a function


/** */
static create3DObj = (url = “”, scene, canvas) => {
scene.enablePhysics();

//--- loader ---
//scene.getEngine().displayLoadingUI();
//CoreVrPlayer.myLoader();

const camera = new ArcRotateCamera(
  "",
  Tools.ToRadians(90),
  Tools.ToRadians(90),
  2000,
  new Vector3(0, 0, 0),
  scene
);

camera.useNaturalPinchZoom = true;
camera.wheelPrecision = 0.1;
camera.pinchDeltaPercentage = 0.003;
camera.pinchPrecision = 0.1;
camera.panningSensibility = 0.01;
camera.useNaturalPinchZoom = false;
camera.zoomToMouseLocation = false;
let cameraTarget = new Vector3(0, 0, 0);
camera.setTarget(cameraTarget);

const pointers = camera.inputs.attached.pointers;
pointers.multiTouchPanning = false;
pointers.multiTouchPanAndZoom = false;

scene.activeCamera.attachControl(canvas, true);
scene.useRightHandedSystem = true;

const lightObj = {
  type: "hemispheric",
  name: "light001",
  x: 0,
  y: 0,
  z: 0,
  intensity: 1,
  scene: scene,
};

CoreVrPlayer.makeLight(lightObj);

let fileName = url.split("/")[url.split("/").length - 1];
let urlPath = url.replace(fileName, "");


SceneLoader.Append(urlPath, fileName, scene, function (scene) {
  scene.createDefaultCameraOrLight(true, true, true);
  scene.activeCamera.alpha += Math.PI;

});

/*
const loader = SceneLoader.Append(
  "https://raw.githubusercontent.com/BabylonJS/MeshesLibrary/master/",
  "PBR_Spheres.glb",
  scene,
  (newMeshes) => {
    camera.target = newMeshes[0];
  })
  */

/*
let assetsManager = new AssetsManager(scene);
let meshTask = assetsManager.addMeshTask(
  "test",
  "",
  "https://raw.githubusercontent.com/BabylonJS/MeshesLibrary/master/",
  "PBR_Spheres.glb"
);

meshTask.onSuccess = function (task) {
  task.loadedMeshes[0].position = Vector3.Zero();
};

assetsManager.load()
*/

/*
SceneLoader.ImportMesh(
  "",
  "https://raw.githubusercontent.com/BabylonJS/MeshesLibrary/master/",
  "PBR_Spheres.glb",
  scene,
  function (meshes) {          
      scene.createDefaultCameraOrLight(true, true, true);
      scene.createDefaultEnvironment();
  });
  */

/*SceneLoader.ImportMesh(
  "",
  urlPath,
  fileName,
  scene,
  function (meshes) {
    scene.createDefaultCameraOrLight(true, true, true);
    scene.createDefaultEnvironment();
    scene.activeCamera.alpha = Math.PI / 2;

    //setTimeout(() => {
    //  scene.getEngine().hideLoadingUI();
    //}, 4500);
  }
);*/

}; //create3DObj

Hi and welcome abroad!
Is the @babylonjs/loaders package in your package.json?

Hi thank U to good to me.
Yeas, I use import “@babylonjs/loaders/glTF”; ( npm i @babylonjs/loaders)

I try to use babylonJS since 10 months to make a “player” that I use in VR headset “meta” and on browser on classic device. I can manage right video and photo dome by babylonJS and import 3Dobj right too.
In a ES6 Vanilla project.

I can try now to use BJs in a create-react-app I can manage right video and photo dome but not import 3Dobj right.

I retrive always
BJS - [15:03:22]: Unable to load from https://s3.eu-south-1.amazonaws.com/ai-assets-storage/system/resources/objects/01H668K63F9TSMDJ3TXR1MVNRB/scene.gltf: _this3._babylonScene._forceBlockMaterialDirtyMechanism is not a function

I try to use SceneLoader.ImportMesh / SceneLoader.ImportMeshAsync / AssetManager.Loader…and many more workaround but I retrive always same error message. I loonkingFor “forceBlockMaterialDirtyMechanism” on google but don’t exists any reference.

Can u help me ? thank in advanced.

Hmmm, forceBlockMaterialDirty is part of the Scene class: https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/scene.ts. Do you import Scene somewhere in your code? If not, can you try adding it?


image

I’m reCheck all, I pass scene and canvas like method params like in other methos.

Hi, apologies for not following up earlier, are you still having this issue?