第三.js node.applyMatrix4 不是一个函数



我目前正在尝试使用以下代码使用三个.js FBXLoader 加载 .fbx 文件:

var fbxLoader = new THREE.FBXLoader();
fbxLoader.load('assets/item2.fbx', function (object){
object.position.y = - 100;
scene.add(object);
console.log("Object inserted.");     
fitCameraToObject(camera,object,2,controls);
controls.update();
animate();
},
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
function (err) 
{
console.error(err);
} 
);

(第 122-138 行(

但是它在加载我的页面时给了我这个错误 webGLLoader.js:

8.514530412006819% loaded
webGLLoader.js:132 100% loaded
FBXLoader.js:3252 THREE.FBXLoader: FBX binary version: 7400
webGLLoader.js:136 TypeError: node.applyMatrix4 is not a function
at FBXLoader.js:827
at Mesh.traverse (three.js:5686)
at Group.traverse (three.js:5692)
at FBXTreeParser.parseScene (FBXLoader.js:819)
at FBXTreeParser.parse (FBXLoader.js:130)
at FBXLoader.parse (FBXLoader.js:102)
at Object.onLoad (FBXLoader.js:54)
at XMLHttpRequest.<anonymous> (three.js:35758)
(anonymous) @ webGLLoader.js:136
(anonymous) @ FBXLoader.js:60
setTimeout (async)
(anonymous) @ FBXLoader.js:58
(anonymous) @ three.js:35758
load (async)
load @ three.js:35736
load @ FBXLoader.js:50
(anonymous) @ webGLLoader.js:123 

github上已经讨论过类似的问题: https://github.com/mrdoob/three.js/issues/18523

问题是您正在使用与three.js核心库不同步的FBXLoader版本。FBXLoaderthree.js等示例文件必须来自同一版本。所以我建议你将这两个文件升级到最新版本,然后运行时错误应该消失。

three.js R113

最新更新