Constraints lagging by one frame

I have been trying to find an answer to this issue for a while now but it wasn’t really a massive problem (or at least I hadn’t realized how big a problem it was) until recently. Essentially, I have a character with animations for multiple guns. However, the characters arms use IK constraints in order to stay attached to the same position on the gun at all times and when I do the animation the IK constraints lag behind the gun by one frame.

This by itself is not a problem because I thought that when I was done I would be able to bake the animation and move all of the frames for the arms back by one frame. The problem comes because there are parts of the animation where the IK constraints influence is set to zero so that the hand can leave the gun (for example to reload) and these parts do not lag and so either the IK constraint parts of the animation will be out of sync or the reloading (etc.) parts will be.

Animating with the lag is not a major problem for me but I can’t afford to go through the animation frame by frame for each gun to sort the problem as this would likely take weeks, besides the fact that I am looking to add another twenty or so guns in the future and am simply checking that what I’m doing it feasible at the moment (and I’m actually quite glad that I checked).

I have included the pre-bake file in the attachments but obviously to get the final version the objects would all be baked with the remove constraints option selected.

Thankspre-bake player model.blend (3.08 MB)

Sounds like a dependency graph issue. You could try ticking these boxes. This is a hack to solve some lagging issues.


Select your armature. Properties (box), Relations Extras, try ticking the Extra Data Update first to see if it fixes the issue.

Good luck!

Took a quick look at the file, you have a few cyclic dependencies going on with your character rig and all the other rigs. Open your file, tab from pose mode to edit mode, then back to pose mode and check the console window for error messages. This is probably what’s causing your problem of lagging a frame behind. This is a mild case, normally cyclic dependencies cause bones to flip out and rotate wildly and without control. Mild cases like this generally show up when you move a bone, then cancel the move, and all the bones don’t return to their previous position. Moving a frame will correct the bones, but it’s a sign there’s something wrong.

A cyclic dependency is when your bone hierarchy and your constraints conflict with each other. Example: create 2 bones pointing at each other, make one a child of the other bone, then slap track-to constraints on each one targeting the other one. It won’t work, just like an ik controller bone can’t be a child or connected to any of the bones in the ik chain.

Good luck,
Randy

You wouldn’t happen to be referencing your characters into the scene would you?
I had problems constraining objects to referenced characters … I eventually figured out the issue:

When blender links in rigs, it brings in a reference of the rig (which is not editable), and then it also creates a local “proxy rig”. You’re allowed to pose the latter, and then the reference copies the proxy. When you constrain objects however, you need to make sure that you only constrain to bones of a proxy rig! Do not constrain to the bones of the referenced rigs! The referenced rigs appear to be a dead end in the dependency graph - so there’s a lag of 1 frame.

Thank you DanPro, Revolt_Randy and TwirlySocrates (who I have to say has an awesome username) for getting back to me so quickly.

First off, DanPros recommendation works so far as I can see, updating the armature and player to the right frame (although it should be noted that the steps he describes should also be repeated on the player object otherwise it won’t update with the armature to the right frame).

So far as I can see I don’t have any cyclic dependencies (other than maybe conflicting constraints, of which only one will have influence. I tried to use the console window while swapping from edit mode to pose mode but I couldn’t get the effect that you described. However, DanPro seams to have a solution that works and so I will probably use this in the future. Thanks for the help, however.

And seeing that I don’t have a clue what referencing characters in a scene means, although I’m sure that I should, I don’t think that this is the problem but again, thanks for the help - this is definitely something I’m going to have to look into though.

Thanks again

Yes, your IK’s are lagging. A normal IK arm is set with the arm being influenced by the Hand IK. You are correct to have a “Copy_Rotation” for the normal hand to the IK.

For the arms you will need two extra bones called Pole Targets. These Targets will allow you to position the arm correctly. Depending on the the bone rolls you might get some odd results, if so adjust the pole angle. Usually the pole angle can be adjusted with -90, 90, or 180 degrees should work.

Naming convention for blender bones is .L for left and .R for Right [Left Arm Lower = Arm Lower.L]

Conclusion:
+Hands Should only need a “Copy Rotation” Modifier to the IK bone.
+Arm Lower’s would need the “IK” Modifier instead of the hand.
–Pole Target bones should be made if using IK’s
–Adjust Pole Angle to keep arms perpendicular to the ground
—Pole targets are location bones that points where the elbow bends to.
+Names for bones could be changed with .L’s or .R’s for faster animation.
–If using this in a game I would recommend using underscores (_) instead of spaces. This will help with scripting.

_______________________________________________________________________________________________

GAME RELATED:
It sounds like you are trying to build this character for a game engine. Not sure if you are but just incase please read on. Deform Ticks should be off for bones you do not want in the engine. To find this deform tick box you need to go to your Bone tab. It’s right beside the Bone Constraints tab. Scroll down and you will see “Deform” with a tick box you can check or uncheck. Now that you have unchecked the bones you didn’t need like (pole_targets and IK bones). You can now export the armatures under FBX. I would recommend using the 6.1 ASCII. The 7.4 binary gives odd results but you can try though. It’s just within my experience that it gave an extended name to each of the bones. I have never tried a multiple armature fbx so I’m not sure how it will go. Be sure to select the objects and armatures you would want for the single FBX before you export. Once here you should get a export page and a settings down on the lower left of your screen. This is where you have your export settings. After export it does a natural bake to those Deform bones for both 6.1 and 7.4 either you choose.

The following is what you might need to change. Anything else from these settings will give alternate results. What I don’t say you shouldn’t need to change. Apply Modifiers for instance, you’ll want this checked of course.

Version FBX 6.1 ASCII (Export Settings):
Selected Objects [Checked]

Forward:(Depends on your engine) Unity/-Z Forward
Up:(Depends on your engine)Unity/Y Up

[Armat][Mesh] #The only things checked/highlighted

Checked Tick Boxes:
Only Deform Bones
Animation
All Actions
Optimize Keyframes

Unchecked Tick Boxes:
Loose Edges
Tangent Space
Default Take

Version FBX 7.4 Binary (Export Settings):
Selected Objects [Checked]

Forward:(Depends on your engine) Unity/-Z Forward
Up:(Depends on your engine)Unity/Y Up

[Armat][Mesh] #The only things checked/highlighted

Checked Tick Boxes:
Only Deform Bones
Baked Animation
Key All Bones
All Actions

Unchecked Tick Boxes:
Loose Edges
Tangent Space
Custom Properties
Add Leaf Bones #If you want to edit this armature from export. I personally don’t use them.
NLA Strips #I haven’t found a use for it but if you do you can “Tick” it

Thanks @DanPro , I had similar 1 frame lagging issue but I had 2 piston parts pointing at each other with “Damped Track”. Ticking those boxes fixed it.