Blender export bones rotation pivot
See original GitHub issueDescription of the problem
In Blender I’ve created a mesh, attached armature and a simple rotation animation on one of the bones, called “head” (connected to another, named “stomach”).
When exporting to Three.js I get two issues. The first is that for position yz are flipped, similar for rotation. This was easy to solve by hacking the exported animationKeys to flip them to work with threejs. How I did that was inside the parseAnimation function, under the comment // ...assume skeletal animation I added this:
for (let i = 0; i < animationKeys.length; i++) {
let keys = animationKeys[i]
let diff = [keys.pos[0] - bones[h].pos[0], keys.pos[1] - bones[h].pos[1], keys.pos[2] - bones[h].pos[2]]
keys.pos = bones[h].pos.slice()
keys.pos[0] += diff[0]
keys.pos[1] += -diff[2]
keys.pos[2] += diff[1]
diff = [keys.rot[0] - bones[h].rotq[0], keys.rot[1] - bones[h].rotq[1], keys.rot[2] - bones[h].rotq[2], keys.rot[3] - bones[h].rotq[3]]
keys.rot = bones[h].rotq.slice()
keys.rot[0] += diff[0]
keys.rot[1] += -diff[2]
keys.rot[2] += diff[1]
keys.rot[3] += diff[3]
}
I suppose that is mostly a hack to get it to work for me, it should really be in the exporter python script, I’ll look into that later. That was just the context, the second issue is what this post is about.
When running the animation the pivot point for the “head” bone’s rotation looks to be at 0,0,0 while in Blender it’s relative to it’s position (parent?). The result is the following:
I tried to “hack” in a way to set pivot point myself, just to see if I could get it to work, but I couldn’t find how.
The export settings I use are the following (although I’ve tried pretty much every variation of settings I could think of):

This is an issue but I’m not 100% sure how it’s supposed to work (regarding pivot points for bones).
Three.js version
0.82.1 (latest from npm at time of writing)
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
The JSON Blender exporter has been removed with
R93(#14117).Also see: https://threejs.org/docs/#manual/introduction/Loading-3D-models
Interesting! Looks like both animations and flipped values work well when just exporting the model and not the scene.
That’s good enough for me. I would still consider it a bug that it gets wrong when exporting scene/hierarchy but for my purposes I can get it to work like this.
Thanks!