Correct Way to Export Skeleton Animation in Blender?

Here’s a simple setup that’s trying to load a models.json file and play skeleton animations.
https://pastebin.com/yFvj9BhB

If I place the object & armature at origin, things are fine, like seen on right.
question1

However, I want to have all my objects in this single json file so I cannot have them all lumped at origin, I’ll place them side by side. The problem I’m having is if an object & armature is not at origin, the animation plays messed up, as seen in the bottom half of the picture below.
question2

I tried a few things like changing/removing parents in blender, check on/off the hierarchy in export settings…
I just can’t find the correct method. It keeps messing up whenever the armature is not at origin.

Any solutions?

1st question, why do you want to seperate the bone and object if you’re trying to animate thsm together.
2. You can export the objects at origin , when you load them on threejs, you can access the objects and place them in the positions you want or am i missing something?

1.I don’t necessarily want to separate them, just tried to see if it would fix the problem, maybe parent relation affects the positioning or something.

2.I’ll have multiple objects so lumping them all at the origin won’t look good as seen below on the right. I want to be able to scatter all the object & armature pairs around.
question4

You are exporting as JSON, right? Have you tried exporting as GLTF instead?

Do you actually know if GLTF allows what I want here? Because I seem to have a problem.

So I got the exporter & loader scripts and managed to get 1 object playing. It doesn’t have to be at the origin, good.

Then I tried adding a second object & armature pair with its own animation.
question10

But for some reason, now the cylinder is not visible (I am adding “gltf.scene” as a whole). Also, the T-shape is not animating correctly. I had a look at the structure of data from GLTFLoader and it seems to be putting all animations in 1 array element, all bone key frames are combined into 1 merged scene animation. I was looking for each animation set to be assigned to each object separately.

question11

Did you actually try having all your game characters, their parts & animations in 1 single file and then loading them at once to later extract & clone individually whenever you needed them in the game? If so, what’s the best approach to do this.

Basically, imagine your game enemy objects in a single file. Each has its own armature and animations like “idle”, “walk”, “attack”… Is exporting this setup possible?

Do you actually know if GLTF allows what I want here?

No idea, sorry :slightly_frowning_face: I’m not especially familiar with either Blender or GLTF.

You maybe run into this issue:

https://github.com/KhronosGroup/glTF-Blender-Exporter/issues/112