我正在尝试加载两个不同的Maya动画文件,但是只有一个是动画,而第二个不是。
我尝试使用fbx加载程序加载fbx文件
var loader = new THREE.FBXLoader();
loader.load('models/jumpi.fbx', function(object) {
mixer = new THREE.AnimationMixer(object);
var action = mixer.clipAction(object.animations[0]);
action.play();
window.addEventListener("keydown", function(event) {
if (event.defaultPrevented) {
return; // Do nothing if the event was already processed
keyPressed = event.key;
// If the button pressed is "e" or "E" (using caps lock or shift), then the player jumps.
if (keyPressed == "e" || keyPressed == "E") {
// call your jump function.
// console.log('working');
//action.play();
}
// Cancel the default action to avoid it being handled twice
event.preventDefault();
}, true); object.traverse(function(child) {}); scene.add(object);
});
var loader = new THREE.FBXLoader(); loader.load('models/move.fbx', function(object) {
mixer = new THREE.AnimationMixer(object);
object.traverse(function(child) {});
object.position.y = 2;
object.position.x = 50;
object.scale.x = 20;
object.scale.y = 20;
object.scale.z = 20;
scene.add(object);
});