I'm trying to get a simple animation retargeting function working to change from one rest pose to another (with the same bones and overall skeleton layout). It works properly on bones that are unchanged from the source rest pose, but any that are animated seem to only have correct rotation on one axis, the other two axes seem to be flipped. The data is being imported from blender via GLTF and I've verified that the rest poses and animation data is correct, so I'm not sure what I'm doing wrong.
I've tried swapping quaternion multiplication order in almost every spot it's used, but that just seems to make the result completely wrong.
I'm using the Quaternion and Float3 structs from the ozz-animation library.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.