@prominent in case it helps you one day, I figured it out!
The reason this is happening is because in:
function boneLookAtWorld(bone, v) {
scene.attach(bone)
boneLookAtLocal(bone, v)
bone.parent.attach(bone)
}
when we attach the bone to scene, scene becomes the bone’s new parent. So after we perform the rotation via boneLookAtLocal() and reattach the bone, we aren’t reattaching the bone to the original parent! The bone is just being reattached to the scene which it is already attached to.
This is solved by changing boneLookAtWorld() to:
function boneLookAtWorld(bone, v) {
const parent = bone.parent;
scene.attach(bone)
boneLookAtLocal(bone, v)
parent.attach(bone)
}