Pose Position and export fbx

Hi, now I got it working so far, one thing is still not clear to me, it has to do with Rest and Pose Postion.

I have a gun model in the same file as the character. The Child to Constraint works for the root bone of the gun to the characters hand, I can create animations.

When I export the gun and the character now to Unity as separate fbx files to unity, and I do this in rest pose, now animation is played then in Unity, I have to do this in Pose Position. But when I export the gun in pose position (where it is in the characters's hand), the position of the gun is not at 0,0,0. How to avoid this?

  • crew

    Just to clarify - the position of the gun's root bone or the position of the gun armature's origin? 

    If you'd like, you can tell Unity to ignore the root's transformations when importing the FBX of the gun - that way you should be able to parent it to the hand like in Blender or do anything else you need to! 

  • The position of the gun' s root bone after the posing - the location of the armature is at 0,0,0. When I move it to the location at which I adjust it to the hand and then export, the origin of the model is at this location when I import it into unity. I searched for a way to ignore the root bones's transform in Unity, but it doesnt work. When I export after clearing the transform (or go to a pose that I stored in a PoseLib) everything works fine. I will send an image when Im back in my office.

  • It works now, even if I export from the hand's position. The animation is for the slide of the pistol, so it doent change the root bone's transform, in Unity the animation is in the preview displayed with an offset:

    Another strange thing:

    Having an animation of the character (arms) in Blender active in the NLA editor (and the pistol's root) has a ChildOf constraint to the character's hand, the animation is displayed weird in Unity (rotated and wrong position).

    So when there is no action here:

    The animation is displayed correctly, but when I add an action here, the animation is rotated and has an offset.

    Could it be the case that when I export with this action of the character active, the root bone of the pistol is transformed as well because it has a constrained - wow, is this complicated:-)

  • crew

    wow, is this complicated:-)

    Haha yeah it is! I think it would be much faster to solve if I could see your file (from before the actions are baked). Would you mind sharing it via Dropbox, OneDrive, or pasteall.org?

  • Ok will do, but before I think I have to understand first what the NLA editor does, I have to fill this knowledge gap. I have animation actions for the character rig and and for the pistol rig. When I play an animation in the action editor, it is added to the NLA editor like this:

    But what I dont undertand here:

    Why is the Pistol_Aim, which is an action for the LP_Arms (the arms armature) added to the Pistol_Armature in the NLA edtior after I played it? And why is it added to the pistol Mesh as well. Is it because I had these objects selected while I was playing the animation.

    This can be very confusing, especially if the actions that are displayed in the NLA are taken into account when exporting the models - and or me it seems that it has an effect.

    I begin to understand the NLA editor, but is there a way to not use it, also that when I play actions in the editor and have the "wrong" object selected, that these are not added to the NLA editor for the selected object?

  • crew

    The secret to the NLA editor is the action editor. If you have both open at the same time then it makes more sense. 

    In this example I'll just animate a cube and a sphere. In the Dope Sheet you can see that the CubeAction is under the Cube object and the SphereAction is under the Sphere object. 

    When you switch to the Action Editor though, you can only edit one action at a time. The Action Editor displays the active action for the active object. I have the Cube selected in the 3D view, so I'm editing CubeAction because that's its active action. 

    Let's say I still have the Cube selected but in the Action Editor I switch to the SphereAction. Now the Cube's active action is SphereAction, as we can see if we switch back to the Dope Sheet. 

    Here's where the NLA editor comes in. It allows you to have multiple actions per object instead of just one active one. Whatever you have open in the Action Editor will be the active action. Check out what happens if I swap actions with the cube selected:

    Now, with the CubeAction assigned to the cube, I'll use the push down button in the NLA editor. This makes it a strip and you'll notice that the Action Editor is now empty because we are no longer editing that action. Now we can slide this strip around and do whatever we want with it as a whole - it's like the action is now in object mode instead of edit mode. 

    Now if we choose the SphereAction in the action editor, the SphereAction will jump into the cube's active action track. 

    I'll hit X in the Action Editor to clear that out though, and instead hit tab on the CubeAction strip in the NLA Editor. Just like entering and exiting edit mode, that allows us to edit the action. It's now jumped to the active action track and appears in the Action Editor. 

    So, to fix your issue, make sure the action in the action editor matches the selected object. Also, don't switch what you're animating by swapping what action is active. Instead, select the object and hit tab on its action in the NLA editor. 

    Hope that helps!

  • Thx a lot for the answer, now it makes sense to me. Takes some time to get used to it but I see the benefits.