I export a 3D Model from Blender and use Shape Keys to move a group of vertices. Everything works fine in Blender.
I export in glTF format and manage my group through morphTargetInfluences.
The vertices are shifted correctly, but the scale of the entire model changes. I can’t understand why and how to solve it?
let loader = new GLTFLoader();
let object;
let gui= new dat.GUI();
let options={morph:0};
loader.load('assets/3.gltf',(gltf)=>{
object=gltf.scenes[0].children[0];
this.scene.add(object);
let morphChange=()=>{
object.morphTargetInfluences[0]=options.morph;
};
gui.add(options,'morph',0,1).onChange(morphChange);
});
Can you please demonstrate the issue with a live example? Or maybe share your code as a git repository? I’m afraid it’s not possible to find the root cause with your provided code snippet.
I think I’ve found the issue. Please import GLTFLoader and other three.js modules like OrbitControls from the official repo like so:
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
You currently use the npm package three-gltf-loader which might use outdated code not compatible with the latest three.js version. After this change, everything works as expected.