AnimationMixer's update method resets model's scale and position

Okay. I’ve found the answer. You must scale and set position AFTER you add the animation to mixer lol

So my code looks like this:

model3ds.forEach((model, index) => {
  const mixer = new AnimationMixer(model.scene);
  model.animations.forEach((clip) => {
    mixer.clipAction(clip).play();
  });
  mixers.push(mixer);

  const size = new Vector3();
  const box = new Box3().setFromObject(model.scene);
  box.getSize(size);
  const scaleVec = new Vector3(3.25, 3.25, 3.25).divide(size);
  const scale = Math.min(scaleVec.x, Math.min(scaleVec.y, scaleVec.z));
  model.scene.scale.setScalar(scale);
  model.scene.position.y = 3;
  model.scene.traverse((object) => {
    object.name = PRODUCT_NAME + featuredProducts3dModels[index].id;
  });
  hideModel(model.scene);
  scene.add(model.scene);
});
1 Like