Unable to create the morph target animation or animation clip from sequence of morph targets

Hey, I have GLTF model in which there are shape keys are present. I am trying to create animation clip from sequence of morph targets using “CreateFromMorphTargetSequence” from AnimationClip in threejs. I am making the animation but when I play the animation no animation is playing. I am trying to move the lips of the character model to make the look like a talking head.
I don’t know what I am doing wrong, please help

async addModel() {
		let model = await this.loaders.loadGltfByUrl("/models/Facial_Expression_Character.gltf");

		model = model.scene;
		this.scene.add(model);
		model.scale.set(10, 10, 10);
		model.position.y = -16;

		
		const morphObj = model.getObjectByName("Face");
		const morphAttributes = morphObj.geometry.morphAttributes;

		this.mixer = new THREE.AnimationMixer(model);				 
		var sequence = THREE.AnimationClip.CreateFromMorphTargetSequence('animation', morphAttributes, 60, true);
		var animation = this.mixer.clipAction(sequence);
		animation.setLoop(THREE.LoopOnce)
		animation.setDuration(6)                                    
		animation.clampWhenFinished = true
		animation.play()

		
		console.log("Model Setup Done!");
		return Promise.resolve("Model Setup Done!");
	}

Tagging for better reach:
@donmccurdy @Mugen87 @drcmda

Please do not “tag for reach.” There’s a large community of volunteers in this forum.

1 Like