How to make blender bones z axis forward in Unity

Hi. I do realize this might be more of a Blender than a Unity question, but I figured that this might be the right place to ask since people on the blender forum might not know the relation between Blender-Unity coordinate system.

My problem is that I want to easily be able to rotate bones on my character by using the LookAt function. Currently this is horrible since I have no idea how the axes on each bone are configured. There are currently two bones I want to rotate using LookAt.

alt text
alt text

In Blender, the bones both bones are pointing out of the arms, and what I want is for the z axis to always point forward, out of the arms in this case, the y axis to point up and the x axis to point right. I suppose that this is something that perhaps has to be done in Blender? Heres how it looks there.

alt text

I know that there are some configurations that can be made when you export as an .fbx in Blender, these have not helped with the bones though. The axes of the whole model are fine. Z points forward, Y up, and x horizontal. Here are my Blender export settings.

alt text

EDIT: I just realised that the picture above is an old one. The forward of my current export is actually set to Z axis, and not -Z axis. This makes the model’s forward face the z direction in unity, but it does not help with the bones.

Is what you’re asking: you must model in z-forward. It’s an absolute basic in video game production.

It’s a pain, but the model would have to be redone.

There are silly workarounds, but they’re silly. Every model you import in to Unity has to be z-forward

Even experienced studios screw this up sometimes: A good example is: on a car model, every little piece of the car, must be z-forward. For example with the left-right wheels/tyres, you cannot just flip-em arround, the right and left must be each individually z-forward.

For getting the mesh to align according to Unity axis just rotate it in Blender to face the right axis and then reset the transformation. Ctrl+ a is the default hotkey.

Not entirely related to your problem I know but I had to mention it since the comments about rebuilding the model from scratch just sounded completely ridiculous.

Now I’m not sure about the armature itself as I’m looking into a similar issue myself. In my case I want to parent various objects to bones and have them match the orientation. So far I’ve only found the above mentioned workaround.

I have found that modifications on model level are too labor intense and the cost of wrapping it with artificial parent transform is too small to be a problem, so I just wrap it in an artificial game object

var currentHolder = new GameObject("_Holder");
var holder = currentHolder.transform;
holder.position = current.position;
holder.LookAt(holder.position + desiredWorldForward,worldUp);

In FBX export settings select Armatures
Primary Bone Axis select Z Axis
Secondary Bone Axis select -X Axis