我有一些相当简单的ThreeJS,只是试图将FBX对象添加到我的场景中。但是,每当我运行它时,在第15行,即我称之为FBXLoader的地方,都会出现“未捕获的TypeError:THREE.fbxloader不是构造函数”。我尝试用最新的版本替换FBXLoader.js和Three.js文件,但没有任何效果。
这是我的代码:
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var loader = new THREE.FBXLoader();
loader.load( 'thrown.fbx', function ( object ) {
mixer = new THREE.AnimationMixer( object );
var action = mixer.clipAction( object.animations[ 0 ] );
action.play();
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.castShadow = true;
child.receiveShadow = true;
}
} );
scene.add( object );
} );
var gridHelper = new THREE.GridHelper( 50, 50 );
scene.add( gridHelper );
camera.position.z = 20;
camera.position.y = 10;
var animate = function () {
requestAnimationFrame( animate );
renderer.render( scene, camera );
};
animate();
任何帮助将不胜感激!已经工作了几个小时都没用。