Warm tip: This article is reproduced from stackoverflow.com, please click
javascript three.js

Three.js node.applyMatrix4 is not a function

发布于 2020-04-10 16:11:12

I am currently trying to load a .fbx file using the three.js FBXLoader with this code:

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);
} 
);

(Lines 122-138)

But it is giving me this error upon loading my page 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 
Questioner
tandrus13
Viewed
168
Mugen87 2020-02-02 06:31

A similar issue was already discussed at github: https://github.com/mrdoob/three.js/issues/18523

The problem is that you are using a version of FBXLoader which is not in sync with the three.js core library. Examples files like FBXLoader and three.js must be from the same release. So I suggest you upgrade both files to the latest version, then the runtime error should go away.

three.js R113