Hi,
I am animating a a bone procedurally, by making it lookat() a point in space which I move around.
the result was however not as expected, as the mesh was wrongly deformed.
anyway, after a while I found out that it's all because the bone's transform.forward isn't the forward direction it has in blender.
It appears the bone's Z-axis in blender is it's forward direction in Unity,
and the bone's negative X-axis in blender is it's up direction in Unity.
Can anyone explain to me why this is ?
and more importantly, how I can fix this ?
Blender is famous for switching it's Z axis for what is usually another 3D apps Y axis. It took me some time to get used to this, but it's second nature now that I use blender more than most any other 3D package now.
That being said, I would recommend you export your rigged object/mesh via FBX. In the FBX export settings, select the "Rot x90" button, and see if that fixes your problem.
Here is my other trick for exporting rigs from blender to other 3d apps: I learned in Blender some time ago, to create character rigs with the character's head bone pointing towards the +Y axis, so the character is "lying on the floor" in the Blender 3D view. This allows for better export of constraints and rigs to most-other 3d packages, not sure how known this trick is. I then parent the rig to an empty in Blender, and rotate it 90degrees on the x so the rig then appears to be standing upright while I work on it in Blender.
Hope this helps somehow, took me some time to get bones exporting properly for FBX friendly apps from Blender. But this process is VERY easy with Blender 2.53, though unfortunately Unity doesn't support the new B25 .blend file format, SOON HOPEFULLY THOUGH. (Please Unity Devs, add Blender 2.5 blend support soon.) Even Blender 2.49 ca nopen a Blend from 2.5 with few to no issues.