What is wrong with my IK setup

So, I’m trying to correct hands of my character so they always stick to the weapon.
I tried to set up IK for this, but the result is still wrong and I cant figure out what I’m doing wrong??
I had checked several times that all socket names are correct…

IK origin - is my hand socket; IK target - is my weapon socket.

Currently I’m setting IK origin and IK target coordinates in “Event Tick” in my character blueprint → than in my animation BP im getting out those variables and using them in IK part as effector and joint…

I haven’t worked with this at all so take this with a grain of salt. It might be totally useless.

But isn’t IK usually done against the simplified collision and not with the visuals?

Maybe it is snapping correctly to the collision model of your gun which isn’t the result you want but technically the thing you told it to.

As I said. Kinda a shot in the blue on my part. Might be completely off topic and unrelated.

There’s two things that looks a bit off in your screenshots for this to work.

  1. You have to select your wrist (or whatever bone) in the “Two Bone IK” node, currently it says “Bone: None” in your screenshot. Also, after having selected it make sure to set the effector locator space to “World Space”.

  2. I think the “Joint Target Location” is actually the “pole vector location”, IE which location to “point the elbow towards”.
    You usually would want to drive this location based on what animations you’re playing, but for your case now you could possibly get away with unplugging any input and just entering a component space location that’s down and off to the side a bit.

Edit:
Doing this should position the hand at your slot I think. For it all to look right you might need to also drive the orientation of the wrist joint, in case the rifle will be rotating around and stuff. Using something like a “Transform Bone” node and plugging in the orientation of the slot might do it.

Also just a note, I’m not sure why you’re doing the setup this way, but depending on your needs it might have been simpler to just attach the the weapon to the hands rather than the other way around :slight_smile:

I cant believe my eyes that I missed “bone” setting in Two Bone IK setup, omg !! And all other settings of this node! OMG, thank you alot! YOU SAVED MY DAY!!

Its now working perfectly!!! But im not sure what did you mean with joint target location?? I thought I need this if I want to drive my socket instead of bone, but I didn’t get such behaviour. Im not sure if this is possible?

So I moved my rifle socket a little away so it fits with my bone and hand locations nice.

Nice to hear that it works :slight_smile:

Regarding the “Joint Target Location”, in your case of holding a rifle, look at how the arm is rotated differently in this picture:

By setting the joint target location high up to the right of the player the elbow would be aimed up towards it, acheiving something like the arm in the standing-position.
Whereas if you set joint target location to be down by the right hip instead, the elbow would “aim downwards” like in the sitting-position.