I am trying to apply different poses to a 3d model. I am exporting in the gltf format from blender where each pose is a single frame action in the NLA tool. The object appears to load correctly into the scene and animations are present as well, but when I try to play the single frame animation to change the pose, the object doesn’t move out of the rest position.
Here is my code to load and animate the model:
//load 3d object
var loader = new THREE.GLTFLoader( );
//loader.setPath( 'models/3ds/portalgun/textures/' );
loadModel = () => {
loader.load(
'models/race9.gltf',
(object) => {
object.scene.name = "main-scene";
scene.add(object.scene);
var helper = new THREE.SkeletonHelper(object.scene);
scene.add(helper);
mixer = new THREE.AnimationMixer(object.scene);
mixer.clipAction( object.animations[ 0 ] ).play();
console.log(object);
},
null,
(error) => {
console.log(error);
}
);
}
var animate = function() {
requestAnimationFrame( animate );
var delta = clock.getDelta();
if (mixer != null && mixer !== undefined) {
mixer.update(delta);
};
renderer.render(scene, camera);
}
//run game loop
var GameLoop = function()
{
animate();
};
GameLoop();
Below the file I’m using:
race9.gltf (177.3 KB)
https://www.dropbox.com/s/ko6kk78juvluep3/race9.bin?dl=0 (bin file)
Thanks for your help!!
Edit:
Solved using PR at (https://github.com/mrdoob/three.js/pull/13430 - Special thanks to Don McCurdy for the PR) Exported poses as single frames in a normal animation and split the clips in threejs. If anyone has specific questions about what I did, please feel free to ask.