Hi, I’m trying to play animation from glb file with lod.
I made each children of lod. It works well, and it positioned what I wanted to.
but after put Animation mixer with lod. It played animation but, the lod object goes to origin(0,0,0) point
without animation mixer to lod
with animation mixer to lod
and this is code
lod.applyMatrix4(clonedChild.matrixWorld);
for (let i = 0; i < gltfAni.length; i++) {
lod.updateMatrix();
const mixer = new THREE.AnimationMixer(lod);
const clipAni = mixer.clipAction(gltfAni[i]);
clipAni.play();
const modelMixer: modelMixer = { name: '', mixer: mixer, clipAction: clipAni, isOn: false };
if (!gltfAni[i].name.includes('CameraAction')) modelMixer.isOn = true;
mixerList.push(modelMixer);
}
I’m afraid your setup does not work. The animation clips target specific properties of its root object. If you replace the root object with something else e.g. with an instance of THREE.LOD
, the targeting breaks and thus the entire animation.
It seems you can’t combine THREE.LOD
with THREE.AnimationMixer
at the moment.
I used lod for just gives texture detail level. I tried the root object(I think one of the levels object) but it goes strange…
expected scene : moving upside down smoothly
when I put first level object with this code:
..
lod.addLevel(highMesh, 5);
...
...
for (let i = 0; i < gltfAni.length; i++) {
lod.updateMatrix();
highMesh.updateMatrix();
const mixer = new THREE.AnimationMixer(highMesh);
const clipAni = mixer.clipAction(gltfAni[i]);
clipAni.play();
const modelMixer: modelMixer = { name: '', mixer: mixer, clipAction: clipAni, isOn: false };
if (!gltfAni[i].name.includes('CameraAction')) modelMixer.isOn = true;
mixerList.push(modelMixer);
}
it is in position but wrong rotation i guess and still it play animation
And when I put lod in const mixer = new THREE.AnimationMixer(lod);
like this.
it gose position (0,0,0) and play animation upside down
Isn’t this automatically being taken care of through mip-mapping?
I didn’t thought about that…
But let me tell the story that Why I am doing this…
I found that I can’t access my web page becuase of the texture resolution.
so I thought that, I have to resize texture not in local but in web. Because what i make is for service that using external model in to show room. So I can’t resize texture in local.
First I tried texture resize with createBitmap
. It resize in desktop but unfortunately, Mobile web doesn’t support createBitmap
. But I can access to my web on mobile with black texture(by not working createBitmap)
Now I’m trying to use javascript module named pica
it works well I think but still I’m struggling with mobile access.
+++ I tried with all texture resize but it’s not working also…