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.
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.
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.
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.
So there are no export settings to change the bone direction, like the .fbx export settings can change the model direction?
I don't use blender, and I am not a modelmaker anyway. If you mean export settings in Blender I don't know, ask a Blender expert. I'm fairly sure you have to just properly rebuild the model ... from scratch ... I've heard my modelmakers complaining about doing this constantly, there's no way around it. (the SCALE issue is very similar .. it is true in unity import you can change the scale; but that sometimes is not a solution. with the "z forward" issue there's just NO way around it. all game production is z-forward.)
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.
@Lugen: I was also fighting with parenting today (completely new to Unity and Blender), my became to add an extra bones for attachements. My case was; I wanted to attach hair to the head but it ended up in the neck area because of how Unity works (wrong end of head bone).So I added a hair bone to the head that I could use to manipulate the position ;) The benefit with these extra bones is that we can parent objects to the skeleton while manipulating the child and not affect the parent. Example, I can now spin the hair around or make it jump around without manipulating the head bone.
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(current.name+"_Holder");
var holder = currentHolder.transform;
holder.position = current.position;
holder.LookAt(holder.position + desiredWorldForward,worldUp);
holder.SetParent(current.parent);
current.SetParent(holder);
So there are no export settings to change the bone direction, like the .fbx export settings can change the model direction?
– alexanderflinkI don't use blender, and I am not a modelmaker anyway. If you mean export settings in Blender I don't know, ask a Blender expert. I'm fairly sure you have to just properly rebuild the model ... from scratch ... I've heard my modelmakers complaining about doing this constantly, there's no way around it. (the SCALE issue is very similar .. it is true in unity import you can change the scale; but that sometimes is not a solution. with the "z forward" issue there's just NO way around it. all game production is z-forward.)
– FattieIf this is the case, then the model will have to be redone. I guess i'm lucky to find out now and not later. :)
– alexanderflinkOkay, well I guess i'm lucky to find out now and not later. Thanks. :)
– alexanderflink