Exported GLTF from Blender2.8 appears on screen, but cannot be animated using js

Hello,

I’m trying to perform a simple rotation.z += 0.01 on my model

The model was created on Blender, and after exporting, i checked the GLTF file on https://gltf-viewer.donmccurdy.com/. It looks ok.

My latest attempt shows the model on the screen, but it is not moving. The colours also look very saturated.

Working files attached

Any help appreciated. Thank you.

I’ve inspected your glTF asset and it does not contain any animations. Hence, when loading it, gltf.animations is empty.

You can fix this by adding the following bit:

renderer.outputEncoding = THREE.sRGBEncoding;

thanks a ton for the fix!

For the first part of my question, i didn’t explain well. What if i’m not animating the model on Blender, but using javascript to animate. For example in the app.js file, im trying to make it rotate along z axis with this:

function animate(){
    requestAnimationFrame(animate);
    gothdoll.rotation.z += 0.01;
    renderer.render(scene, camera);
}

thanks again

Change your code to:

gothdoll = gltf.scene;

gltf.scene has more than one child so it seems you selected the wrong one.

i see. cheers ^^