I have this code that runs the animation on the page.

new THREE.ObjectLoader().load( url, function ( loadedObject ) { loadedObject.traverse( function ( child ) { if ( child instanceof THREE.SkinnedMesh ) { mesh = child; } } ); scene.add( mesh ); skeleton = new THREE.SkeletonHelper( mesh ); skeleton.visible = false; scene.add( skeleton ); mixer = new THREE.AnimationMixer( mesh ); idleAction = mixer.clipAction( 'idle' ); walkAction = mixer.clipAction( 'walk' ); runAction = mixer.clipAction( 'run' ); actions = [ idleAction, walkAction, runAction ]; actions.forEach( function ( action ) {action.play();} ); json() }); function animated() { var mixerUpdateDelta = clock.getDelta(); mixer.update( mixerUpdateDelta ); } function json(){ requestAnimationFrame( json_end_scene ); animated() renderer.render( scene, camera ); } 

But there is a small problem in that for a normal conclusion it is necessary to know the exact name of the action. Which is extremely uncomfortable

  idleAction = mixer.clipAction( 'idle' ); 

I tried to insert as in most examples

  var action = mixer.clipAction( child.animations[0] ) 

I still do not understand what it is necessary to hook on ".animations [0]" so that it would work normally. Does anyone have any idea how to do this?

  • I would have a good time to look, but there is no place without a model .. - Stranger in the Q
  • @StrangerintheQ I used the usual model from the example marine_anims_core.json - zeni1agent February
  • what example? - Stranger in the Q
  • @StrangerintheQ webgl_animation_skinning_blending.html only feature is that there are 2 different versions first threejs.org/examples/webgl_animation_skinning_blending but there gltf is used and the second which is in the examples folder in the archive three.js-master which is downloaded on the official site. I used the second option. I do not know why on the website and in the archive they are different. - zeni1agent 2:13 pm

0