温馨提示:本文翻译自stackoverflow.com,查看原文请点击:javascript - Three.js node.applyMatrix4 is not a function
javascript three.js

javascript - Three.js node.applyMatrix4不是函数

发布于 2020-04-10 18:05:12

我目前正在尝试使用Three.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 

查看更多

提问者
tandrus13
被浏览
90
Mugen87 2020-02-02 06:31

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

问题是您使用的版本FBXLoaderthree.js核心库不同步示例文件,如FBXLoaderthree.js必须来自同一版本。因此,我建议您将两个文件都升级到最新版本,然后应避免运行时错误。

three.js R113