From 62f8cd67afce71c10f2fa151b450c4c16c9af0da Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 29 Dec 2018 21:09:14 +0100 Subject: [PATCH] Examples: Simplify webgl_loader_fbx --- examples/webgl_loader_fbx.html | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/webgl_loader_fbx.html b/examples/webgl_loader_fbx.html index 0846b8b0926138..f997f10c604d29 100644 --- a/examples/webgl_loader_fbx.html +++ b/examples/webgl_loader_fbx.html @@ -57,7 +57,7 @@ var clock = new THREE.Clock(); - var mixers = []; + var mixer; init(); animate(); @@ -108,10 +108,9 @@ var loader = new THREE.FBXLoader(); loader.load( 'models/fbx/Samba Dancing.fbx', function ( object ) { - object.mixer = new THREE.AnimationMixer( object ); - mixers.push( object.mixer ); + mixer = new THREE.AnimationMixer( object ); - var action = object.mixer.clipAction( object.animations[ 0 ] ); + var action = mixer.clipAction( object.animations[ 0 ] ); action.play(); object.traverse( function ( child ) { @@ -158,15 +157,9 @@ requestAnimationFrame( animate ); - if ( mixers.length > 0 ) { + var delta = clock.getDelta(); - for ( var i = 0; i < mixers.length; i ++ ) { - - mixers[ i ].update( clock.getDelta() ); - - } - - } + if ( mixer ) mixer.update( delta ); renderer.render( scene, camera );