Hello! I have two questions:
-
I am using a GLTFLoader for loading my 3d model with armature and special pose
loader.load( ‘./untitled17.glb’, function ( gltf ) {
/*gltf.scene.traverse((o) => { if (o.isMesh) { o.material = new THREE.MeshPhongMaterial({color: 0x46C6E7}); o.updateMatrix(); } });*/ scene.add( gltf.scene ); gltf.scene.castShadow = true; gltf.scene.rotateX(-1.5708); gltf.scene.position.set(0, -3.65, 0); console.log(gltf.scene.children[0].children[0]); var helper = new THREE.SkeletonHelper( gltf.scene ); scene.add( helper );
}, undefined, function ( error ) {
console.error( error );
} );
But when I try to change material with that commented piece of code, my model became in rest position, but skeletonhelper shows that skeleton is in the right pose. What do I do wrong?
- I was trying to JSON.stringify() bones object from gltf.scene to save skeleton and then load it with JSON.parse() but it breaks functions inside object, throws a lot ‘uncaught TypeError: children[i].updateMatrixWorld is not a function’ erros and doesnt work at all. Is there any way to load dynamicly pose for model from json string?
I will be very glad if someone answers me.