21

I have a model in Blender with a full rig, including IK bones.
I also have a sword with two bones, on the top bone of the sword I have a set of constraints that copy the location and rotation of a child bone in the right hand.

The sword is then attached to the hand as expected. The second bone in the sword rig is the target for the left hand constraints that copy its location and rotation. In blender that works as expected.

I animate the primary rig right hand and the sword and the other hand moves as expected. The problem comes when I import the blender file into unity.

Unity is only seeing the right hand move but not the left. I can parent the sword to the right hand and it moves as expected. But the left hand data is not changing.

Back in blender I thought that if I were to select the left hand insert a keyframe (LocRotScale), when there was a keyframe for the right hand, that blender would then save the global position of the left hand, but when the new keyframe was inserted it had an orange line to the previous keyframe indicating that the position had not changed.

Is there away to get blender to save a keyframe for the left hand when the constraint moves it?

gandalf3
  • 157,169
  • 58
  • 601
  • 1,133
Goff
  • 313
  • 1
  • 2
  • 4

3 Answers3

14

You could use Object > Animation > Bake action
(Or if you are in Pose mode, Pose > Animation > Bake action)

enter image description here

Bake action was added to the menu in Blender 2.62 (though it was previously available with Space> Search)
Unfortunately, there does not seem to be any documentation for this feature yet.

gandalf3
  • 157,169
  • 58
  • 601
  • 1,133
  • I don't seem to have that option with a bone contraint. When I open the menu I only have the top three options of your sub-menu. Could the bake option be in a diffent spot for bones? – Goff Aug 25 '13 at 04:59
  • Are you using the latest version of blender? – 00Ghz Aug 25 '13 at 08:52
  • @user1874355 It seems to be there in 2.68a (r58536)
    It is there in pose mode and object mode.
    – gandalf3 Aug 25 '13 at 20:36
  • I am using blender 2.60, I will upgrade and see if that makes a difference. I havn't upgraded in awhile because that version has done well for me. I will upgrade and post the results. – Goff Aug 26 '13 at 16:45
  • I upgraded to blender 2.68a. With the constraints active on the bone in pose mose I hit crtl-a and apply visual transform. I then disable to constraints and watch the position of the bone. The bone is not animatated like it was while the constraints were active. Should this feature be able to set the position of the bone? While the constraint was active I watched the psoition of the bone and it was not changing to represent the global position of the bone, is that an issue? – Goff Aug 26 '13 at 19:31
  • @user1874355 AFAIK, Bake Action and Apply visual transform are not the same. Have you tried Object > Animation > Bake action? – gandalf3 Aug 26 '13 at 19:34
  • I just tried Object > Animation > Bake action, with the animation selected in the action editor and the hand selected in the 3d view while in pose mode. I exited pose mode to go to object mode. Then baked the action, it created a new action in the action editor but the hand was not moving. I tried this with the constraint set to pose space and global space, neither animated the hand it simple ripped the hand off the body and had it floating in space. – Goff Aug 27 '13 at 01:10
  • 3
    ok, Object > Animation > Bake action does not do anything appearent for me but Pose > Animation > Bake action from in pose mode does. It creates a new action so it is not very conveinent but it does get the motion that the contraint produces. Thank you all. – Goff Aug 27 '13 at 01:25
8

Sounds like you want to apply the Visual Transform before keyframing:

Apply Visual Transform CtrlA

Apply (set) the result of a constraint and apply this back to the Object's location, rotation and scale. See the following post for more detailed discussion: Apply visual transform.

Aldrik
  • 9,720
  • 22
  • 56
  • I did try that, and it produced some odd errors. I set the influence of the two constraints to 1 set then crtl-a, set the influence to 0 and the hand is torn off the body and floating in space. was I missing something? do I need to delete the key frames of the hand then apply, then readd keyframes? – Goff Aug 24 '13 at 21:06
  • This only applies to Modifiers that do not depend on any keyframes. Constraines like e.g. TrackTo don't work like that since the target object might be moving in an animation based on keyframes. – derHugo Jul 12 '19 at 11:27
3

Use Pose->Animation->Bake Action command location with this settings: bake action settings

it will bake constraint transforms into keyframes on given range. Make sure to select: Visual Keying this will force blender to take visual transforms including transforms that come from constraint and make sure to check Clear Constraints. It wil clear constraint before taking it's visual transforms. If you not check this parameters - retarget won't work properly. This way you can retarget any animation to any rig and from any rig. If you have proper Ik setup, ofc.

PS. This settings are given for blender 3.0 that i'm using currently.

aftamat4ik
  • 201
  • 1
  • 2