加载巴比伦文件会给我index.html而不是JSON

时间:2019-05-20 20:37:35

标签: reactjs webpack babylonjs

我正在使用webpack,React和babylonjs。加载.babylon文件时,我似乎得到了index.html。

当模型保留在源代码中时,我尝试移动。现在它位于src文件夹中。 我也尝试加载stl文件,并得到了相同的错误。

我正在导入装载机。

import * as BABYLON from 'babylonjs';
import 'babylonjs-loaders';

错误是:  Unable to import meshes from /8f86393f3cca3a58b2758e4e7d5b57ec.babylon: importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse SyntaxError: Unexpected token m in JSON at position 0

我尝试过的两位代码

let assetsManager = new BABYLON.AssetsManager(scene);
let meshTask = assetsManager.addMeshTask("RobotTask", "", modelRobot);
meshTask.onSuccess = function (task) {
   task.loadedMeshes[0].position = BABYLON.Vector3.Zero;
   console.log("!!! loaded");
}
meshTask.onError = function (task, message, exception) {
  console.log(message, exception);
}

assetsManager.load();
BABYLON.SceneLoader.Append("", "", modelRobot, scene, function (scene) {

});

0 个答案:

没有答案