Align hand to weapon | world location - relative location

Having a skeletal mesh as weapon, with a socket for each hand attached t it, i would be able to snap the character hands to this socket,

but as you can see in any thirdperson example project, setting the TwoIKBone effector to the socket position result in a non good effect.

So, i’ve added a socket to the character skeletal mesh hand

Now i would know, how to subtract the character hand socket relative location to the weapon L_Hand socket location?

Just get them both in world space and substract one from another. You’ll get relative coordinates to that bone.

31416-ws.png

Thank you resolved in another way. But i have another problem… why ik have a strange lag?

Are you sure your IK node is the last one in the chain?

It can also depend on the way you’ve resolved your previous problem.

I’ve added just a reference socket to get the hand bone position.

Have you been able to solve this? I have a good idea why it happens. The shotgun animates after the main skeleton so your hand is always going to lag behind by a frame unless there was a way to update the main skeleton, update the attached weapon mesh, and then update the left hand.

I myself solved it by computing the relative transform between the weapon’s left hand attachment location and the right hand location. That transform was then used to position the character’s left hand relative to the character’s right hand instead of using the gun’s position that was calculated at that time.

This solved the hand being behind by a frame when the gun was moving around with the right hand. However this still doesn’t fix the shotgun animation because the shotgun still animates after the character and the slide isn’t in the right spot yet. You’d have to either predict where the bone will be which seems like way too much work. Or animate the hand moving back manually with the shotgun slide. I have a bone relative to my wrist rather than a socket that acts as the IK destination so I can move that around. That bone would stay still relative to the shotgun but the hand itself would animate relative to the sliding part.

hi Kheka,
Can you explain what is the difference between hand_lsocket and hand_socket_ref?
Maybe possibly post a picture showing skeleton placements. I dont quite get the solution…

Thanks in advance