I have a Blender scene containing a bunch of objects. Some of these objects have a bone animation but most don't. I am trying to import the scene into Three.js including the animations on the correct objects. Here is a breakdown of the problem that I am experiencing:
- Bone animation in Three.js only work when using THREE.SkinnedMesh.
- Because of the animation data being on all objects, it's hard (if not impossible) to determine what object the animation is linked to, thus making it impossible to load those meshes as THREE.SkinnedMesh instead.
- Even if it was possible to determine the object the animation belongs to, THREE.SceneLoader won't make these into skinnedmeshes itself, resulting in having to delete those objects the SceneLoader made and creating them again manually with a skinned mesh.
I've tried to do this by manually exporting the animated meshes seperately from Blender so the bone animation data is only on those objects, but this raises a problem with the positioning of these objects since the position and rotation of the animated objects is only available in the scene.js exported file from Blender.
- Is there any possible way to export animated objects in Blender as SkinnedMeshes right away, while keeping the rest of the scene intact?
- Would it be possible to determine whether an object has an animation or not in Three.js?
Update
I realized that since I get the objects with an animation separately anyway, I could loop over the scene geometry to check whether or not there is an animation available on the object, and create a SkinnedMesh for it if that's the case. The positioning problem still exists though: The (0,0,0) position and rotation in Three.js positions the object not at the center of the scene, but rather around some other point. I'm not sure what point this is, it could be the Blender scene center but I thought those two would be the same.