Based on Callum’s pattern I got separate gltf’s working, one for the model, one for the animation. Now I want to build a list of disc-based animations to choose my actions for the mixer from. Copy and pasting to a “B-animation” like I did below did not work, my lack of javascript eloquence makes me a rude tourist. Could anyone maybe help me out here?
const gltfLoader = new GLTFLoader()
let mixer = null
gltfLoader.load(‘/models/SC/glTF/out.gltf’, function (body_gltf) {
body_gltf.scene.traverse(function (child) {if (child.isMesh) { child.castShadow = true; child.receiveShadow = true; child.material = new THREE.MeshBasicMaterial({ vertexColors: true, }) } }) let body_model = SkeletonUtils.clone(body_gltf.scene); scene.add(body_model); gltfLoader.load('/models/SC/glTF/crshB.gltf', function (animationB_gltf) { // let animation_model = SkeletonUtils.clone(animation_gltf.scene); // let animation_object_group = new THREE.AnimationObjectGroup(animation_model); // mixer = new THREE.AnimationMixer(animation_object_group); // mixer.clipAction(animation_gltf.animations[0]).play(); // animation_object_group.add(body_model); }); gltfLoader.load('/models/SC/glTF/crshA.gltf', function (animationA_gltf) { let animation_model = SkeletonUtils.clone(animationA_gltf.scene); let animation_object_group = new THREE.AnimationObjectGroup(animation_model); mixer = new THREE.AnimationMixer(animation_object_group); mixer.clipAction(animationA_gltf.animations[0]).play(); animation_object_group.add(body_model); });
});