Left Hand IK problems with spawned firearm

I have a project that has a somewhat simple weapon system; where the player is able to pick up weapons by entering their vicinity, when a weapon is equipped, the game deletes the weapon blueprint on the floor and then spawns two on the player (one for a first person rig and one for a third person rig), it then sets the player as the newly spawned weapon’s owner and then attaches the weapon to the player’s right hand socket.

Using this, I’ve tried to implement a simple left hand IK for the third person rig so that it makes it look like the player actually holds the gun for other players. However, for some reason the hand isn’t going to the desired transforms, and with multiple debugging attempts where I have checked whether the weapon is valid, checked if the transforms are updating and checking the actual transform of the socket to compare with the transforms of where the hand is actually going; its safe to say I have no clue what is going on. everything should be working perfectly according to documentations, but it just isn’t…

Here is the code i currently have (with context)

[Weapon equip code]

(Code that runs when you enter a weapons vicinity)

[setting looted weapon notify]


(the top one is the one i’m focusing on in this post)

[LHIK function]

(Note: This function is later called inside the animation blueprint event graph. Transforms are then stored in a replicated variable named “Effector Transform”)

[Applying the Transforms to both a Two Bone IK node and a Fabrik node]

[Two Bone IK settings]

[FABRIK Settings]

it produces this abomination:


(The hand should be on the handguard according to the LHIK sockets transform.)

[The sockets transform]


(Btw if your wondering why there is not a stock on the gun in the game, its because I haven’t set up the attachments system yet, ALSO: the LHIK is NOT parented to the root, its parented to the foregrip bone and has a relative location of 0, so it is ON the foregrip bone)

Ive checked all bone names and i don’t know what could be happening. If someone could help me figure this out, it would be amazing.

Thanks

Your concept is flawed.

Which hand is the one that can always move to adapt whilst holding a rifle?

Check this

this guy do all the process

The left hand is the one that should move to the LHIK socket.
Also what do you mean its flawed? you have any suggestions for how I can do it?

That’s wrong.

Try holding a boom stick like one would a rifle.

Which of your 2 hands can actually adapt?

(Granted if you have 0 clue how to hold a rifle properly this is a bit harder, but try the broomstick anyway).

Create a Function in your AnimBP class, Call it in the Event Graph.

Have it set the Effector Transform… LHand IK Transform

Apply FABRIK in the AnimGraph

Im not really sure what your getting at here?
Its supposed to have the right hand on the trigger and the left on the handguard.

Try the excercise again - which of your two hands can Always be appropriately placed while holding the broomstick as a rifle?

Hint - it’s not going to be the one on the trigger.

I genuinely have zero idea what the point your trying to make is. I know how to hold a gun, i play airsoft every now and again, and eve told you 3 times now, the left hand is supposed to use a two bone IK to reach the handguard. stop being so sassy and rude.

hey, thanks for the response, but what is the weapon config? I’m not very aware of some of ue5’s features yet as I only really started coding in ue5 around a year ago.

It’s just a custom struct I use to store variables that pertain to the given weapon.
Offset vectors, rate of fire, ammo type etc etc.

1 Like

I only help those smart enough to help themselves.

Help? You came into the discussion and said my concept was flawed and didn’t elaborate on why, then it turns out you think my guy is holding the gun wrong and insult my knowledge, i then tell you again that the left hand is supposed to procedurally move to the weapons handguard, and still you continue to say im wrong and STILL dont elaborate. and you were extremely rude about it too. if thats how you treat people online who don’t understand what your saying, i dread to think what your like in person.

just stop responding man, if all your trying to convey is this smart persona of a character that “only smart people can understand” go back to reddit forums, I’m trying to get help with a passion projects code, not have a back and forth about how a two handed gun is supposed to be handled.

Maybe ask ChatGPT to summarize the meaning - it’s obviously lost on you.

The reason I only help those smart enough to understand is precisely the fact that the absolute last thing the gaming community needs is people like you - incorrectly argumentative, wrongly opinionated, definitely unhinged - eventually becoming “developers" and getting hired by the likes of Ubi :laughing:

With this altitude you sure won’t learn a thing even if your life depended on it, but do “go on" making a fool of yourself :grinning_face:

I asked a question and you barely put in an input to the original question and you were rude when I didn’t understand you. just SAY what you meant! I already told you how my character is supposed to hold the gun and you said it was wrong. Like man I’m just trying to get this working why are you like this? I just want answers and your not giving me them, yet you act and seem like you know them! you want good devs in the industry? help those who aren’t good, don’t just leave them with scraps of an answer.

But, I’ll I’ve you the benefit of the doubt; I got argumentative, it was 9 in the morning and I had just woken up from a bad sleep, so i apologise for that, BUT, you weren’t giving me a straight answer. So, do you want to back track a little and help me to understand why you think my system is flawed? or are you gonna continue to try and belittle me and make me hold a broom?

I want my guy to hold the gun like this:

But something is happening and I don’t understand what it is; but the left hand ISNT going to the handguard, Instead it’s defaulting to the firearms root bone transforms. as shown in the 7th image…

now please if you want to help: help. If you don’t: fine.

Look. On the off-chance you actually mean the above (though really, don’t go supplicating on forums, like a half ■■■■■ “I woke up wrong. My bad. I see now" is really enough for anyone who ment well to help without all the rest.)

You are doing it wrong.

Left hand (in the pic - this isn’t always true because you can swap hands for holding, so call it a Stock hand) is your ancor point.

This is bcause your other hand is the only one which can always try to adapt and actually reach the target.

If you grab your broomstick and try again you may realize - Only the hand that goes near the trigger is actually able to reach as far as the stock holding hand.

So start from that.

With that, then if you are still unable to get the trigger hand to meet the target something is wrong in how you are telling it to reach or setting up the IK.

Nonetheless - your left hand (in the pic) will never reach the “target” even if you just place your right hand (in the pic) further forward.

That’s what will happen next - if it’s not what is happening in your setup already. Ei: flawed concept.

Hmm, I can kinda understand now, but not really at the same time. I’m not on ue5 rn but if it helps ill send a picture of the animations where he is supposed to hold the gun when i am on ue5 so you can get a sense of what I’m trying to do.

Also yes, I am being 100% genuine, I barely slept last night so i was in a bad mood when i saw your reply, but id rather just talk things out logically and try come to an understanding instead of being overly confronting and argumentative. as you said: “the absolute last thing the gaming community needs is people like you - incorrectly argumentative, wrongly opinionated, definitely unhinged”. So genuinely, I’m sorry.

All i really need is to be able to have the left hand go to a fixed socket location with a fabrik / two bone node that i can disable when reloading, inspecting etc… Mostly because when the Aim Offsets are in an area that is in-between 2 poses the left hand starts moving around.

If it starts moving its likely because the goal cannot be reached by the IK.

It’s why it’s a flawed concept. It only works on tailored poses (if even) and if you swap a gun on the same pose it will likely fail.

There is no shortcut here. You need to make a system that enables you to swap the anchor point of the weapon at will - and adapt the arm which can reach the target.

Usually, you define this within the weapon settings and the animations via animation curves.

The swap of the socketing can’t happen on a notify though (because it will fail and drop the weapon or look wrong).

So normally you create a timeline as part of the gun object that then gets used (and modified in instances) to adjust the timing for reloads and such.

Doing it properly is long/expensive/trial and error.

Keep at it. Re-iterate. Its really the only way to learn anyway.

Ah i should probably say; it would move around BEFORE adding the Fabrik node. With Fabrik plugged in it IS getting a location, just not the right one. It’s almost acting as if I’ve misspelled the socket name and is just defaulting to the weapons Root bone, but I’ve triple checked it 3 times and i can confirm i haven’t misspelled it. I’m thinking now that its a problem with getting the currently equipped weapons SKM. But take that with a grain of salt, as I’ve said before I’m an intermediate to ue5 coding