Matching bone rotations in Unity

I’m trying to get the export settings from Blender to match with the oculus Unity movement SDK example model so that I can get custom models to work properly.

The Example model can be downloaded here on github. (high_fidelity_rig.fbx)

When importing it into blender I choose the automatic bone correction option in the fbx importer so the bones are easier to work with. Here’s how they look in blender.

Here’s the fbx straight from github imported into Unity. First, the hip bone rotations here and secondly, the wrist bone rotations here.

Now the problem is, if I’m exporting the same fbx from Blender, (after importing it with automatic bone correction) this is how the rotation axis are in Unity for the hips and for the wrists, they no longer match.

Now as the up axis in Blender is Z but in Unity its Y, I changed the Up to “Z up” in the transform settings of the fbx exporter in Blender. Since -Y is forward in Blender but +Z in Unity, I also changed the forward to “-Y forward” in the Blender fbx exporter.

The bones still don’t match. Here’s the hip bone and here’s the wrist bone. (settings Forward -Y, Up Z, Primary axis Y, secondary axis X)

So I started changing the Primary bone and Secondary bone axis in the Armature part of the FBX exporter, and 40+ combinations later I finally got the wrists to match up as can be seen here. The settings I used here were Forward: -Y Up: Z Primary axis: -X Secondary axis: Z with “apply transform” and “use space transform” off. Screenshot of settings here

Sounds good, but when I look at the hips bone rotation, it’s still off.

Now I’ve tried most of the primary/secondary axis combinations, and they’re all off , I’m wondering how can I get both the hips and the wrists (and the rest of the bones) to rotate the same way from the original .fbx after importing/exporting from Blender?

Here are the combinations of export axis I’ve tried so far:

Forward: -Y Up: Z

Primary -Z Secondary -X

Primary -Z Secondary X

Primary Z Secondary -X

Primary Z Secondary X

Primary -Z Secondary -Y

Primary -Z Secondary Y

Primary Z Secondary -Y

Primary Z Secondary Y

Primary -X Secondary -Z

Primary -X Secondary Z

Primary X Secondary -Z

Primary X Secondary Z

Primary -X Secondary -Y

Primary -X Secondary Y

Primary X Secondary -Y

Primary X Secondary Y

Primary -Y Secondary -X

Primary -Y Secondary X

Primary Y Secondary -X

Primary Y Secondary X

Primary -Y Secondary -Z

Primary -Y Secondary Z

Primary Y Secondary -Z

Primary Y Secondary Z

I’ve also tried these combinations and changing the Transform Forward/Up to some different ones but didn’t log them down.

I’ve tried most of these with and without “Use space transform”, the biggest difference seems to be that I need to enable Bake axis conversion on the imported object in Unity, otherwise its rotated by 180°.

Any tips on how to do this would be greatly appreciated.

TLDR:

I want a rigged example FBX to keep the same bone rotations in Unity after importing it and exporting it from Blender. The rotations are required for the movement sdk to work correctly.