Two Bone IK updating 1 frame later

I have a socket in my weapon which my character is holding.

The weapon mesh is attached to the player mesh.

I find the local location of the weapon socket with respect to the player charactermesh and pass it to the character blueprint and from the character blueprint, I bring it to the animation blueprint.

In the animationblueprint, I use a 2 bone IK to move the left hand bone to the location. But, the problem is there is a 1 frame delay for the hand to move. The hand moves 1 frame after the weapon moves and seems to be trailing behind.

5984f88f0584de0833682e27ff2dc273042baea7.jpeg

We’re having the same issue so I figured I would bump this thread and see if anybody has come up with and answer.

Any ideas out there on this one?

Take the IK position in world-space, take the right hand’s bone transform and perform an inverse transform point on the IK position. Store that as the anim variable (Hand Attachment Location in this case) and then specify in the IK node to use the right hand’s local space (or something like that). The problem is that you’re computing the position before the animation is applied, which is going to be 1 frame behind because the animation will change at the same time as the IK is set. With this change the left and right hand will maintain their relative rotation/position. If it’s still not good enough, you’ll need to run the animation sampling twice, which can be wasteful.

I’ve SOLVED THIS: I’ve simply set the “TickGroup” of my skeletal mesh component to “Post Update Work”. To do that: In your actor blueprint call “Set Tick Group” and choose “Post Update Work”. Thats all lol.

3 Likes

Generally speaking animation executes after code.
You can try to manually call an update of the animation blueprint to force the change.
changing the tick group is a good solution too.

The best solution would be to get the correct value of where it should be in the next frame.
this isn’t always possible. But in the case of something predictable like the position of a hand on a gun, you can offset the location by adding movement speed into the calculation.

Distance is a factor of speed over time. Your time is one frame, so the speed/direction should be all you need to add.

I found that you do not need the blend by pose in this specific case. Two Bone Alpha will take the bool IKLeftHand directly and as it convert to 0/1 you will get the result you want!

I’ve been wrestling with this issue for a long time too. Making aiming systems for weapons to truly aim at their targets. A combination of turret math, ik and manual ik solutions ( wanted 3 bone ik for robot arms and legs). And I was always feel like Im trailing a frame behind the target location. Even implemented a leading system based on the distance of the previous frame target location, but the results were always behind and jittery too it seemed like. Switched over the tick group and omg it locked right on and is so buttery smooth. Thank you so much :slight_smile: like i said this has been ■■■■■■ me for like 2 years now

That’s awesome you were able to figure it out! Sounds like you put a lot of work into it. Were there any tutorials in particular or revelations that you found most helpful in constructing your aiming system? In the very early stages of working on one and I’ve been surprised how little teaching material there is on various aspects of the subject

for me the aiming had to do with being able to offset from the pivot point. If theres no offset its pretty simple vector math (source vector - target vector)

for offsets you need something along these lines UE4 - Offset Turret Rotation Tutorial - YouTube
this isnt the video i found way back, but its the same principle.
Find the radius, find the intersection, find the delta, apply

I tend to lean on the sphere intersection equation to determine these details.

Thats the basis, but implmentation is based on your needs and complexity