Can't seem to get ThirdPersonCharacter to hold Rifle properly? (How to attach Socket to Socket)

I’m very capable of learning but I’m definitely low on the one resource everything feeds off of: Time. And research isn’t telling me what I need to know.

How can I use IK’s or similar for weapon holding?

Quite simply, I’m trying to resolve what it is that I’m going to need to do with all of the weapons I create in terms of animation during run/walk cycles, jumping, and so on. I can’t just add them all to the actor as components and the attach nodes seemingly don’t let me specify sockets from the gun to attach to the parent’s hand(s). I can get fairly close with hand_r and an offset in the BP of the gun actor but I can’t get the hand ik to work (I assume it’s not working because of the message I get in Persona when I select them) and I’m unable to get the rest of the gun to conform to the left hand. And, again, its placement in the right hand is also spotty as is.

Do I need a custom animation for holding seemingly every weapon that doesn’t line up at certain parts? Do I just need to design for it while making the weapons in order to reduce animation requirements?

All that I’m trying to do is have 2 sockets on the gun: Grip (for right hand), and, I dunno, Stock for the left hand, if needed. Then both hands just IK to those sockets while blending their animations otherwise as close to normal.

There are plenty of reasons in games to need to attach a socket of one thing to the socket of another. Often just temporarily (for instance, in Sunset Overdrive sockets and IK are used to make characters grab ziplines, characters in many games use them to hang onto non-socketed ledges, ect.)

What am I missing? This can’t be an unsupported feature. If I’ve learned anything in my understanding of this engine it’s that everything that I need exists, I’m just 3 steps behind where I need to be in order to see it.

Just skimmed through your post super quick, but I think you want to:

  • have a simple system to attach weapons correctly to your character’s weapon hand (so it looks like they’re holding it correctly all the time, i.e. while walking, crawling, running, etc.)

This is actually really easy. Here’s the high level setup you need:

  • character with a bone socket (i.e. in the right hand, if they’re right handed, etc.) This is easy, just open your skeletal mesh character with Persona (dble click on it in the content browser). Use Persona editor to quickly add a bone socket and manually place, and rotate it into position right around the palm of the hand bone (make sure to attach the new socket to the hand bone for simplicity sake). That’s it for this part!

  • if your gun is a static mesh, open it in the content browser so it opens with the static mesh editor (i.e. dble click it!). In the static mesh editor, go to the main menu and look for the mesh socket window (it’s usually hidden by default!). Open that guy up and add a new mesh socket; place and rotate it into the spot on the handle where the player will probably hold it

  • in Blueprint, simply use an attach node to attach the weapon to the character using the sockets you created- it’s that simple.

It may take some adjusting to get the weapon rotated and placed just right, but remember you can always rotate and move sockets until you find the perfect spot for the character to look like thy’re holding the weapon correctly.

I’m using a socket for my weapon and IK only for the left hand (as it usually does not follow 100% in aim-offset otherwise): Rifle Animset Pro - Marketplace - Unreal Engine Forums

A big thanks to both of you! :slight_smile:

Not only did you answer my question but you even improved my workflow quite heavily!

tl;dr Unreal Sinus Infection was developed in 2-3 months after allergy meds were uninstalled. Reinstalling allergy meds alongside a humidifier once I finish wiping the game and refreshing my OS. Unfortunately I run an Android based system so I need more cache. :wink:

Sorry that I couldn’t respond sooner; my significant other and clinic are an hour’s drive away and I finally went in yesterday for my (very VERY well developed :smiley: ) sinus infection.

Hopefully my last since I’ve been working and will finally be able to afford to buy allergy meds and a humidifier (the former I managed to lose out of a bag with a hole in it a few months ago). /Exposition

Edit 3: Found this; looks like it should work; turns out I just couldn’t grasp what was going on in that picture FROM the picture. Will implement later today after I get some other stuff done.

Original Post:

Actually, and I’m quite sorry, but this didn’t solve my problem.

Those are the only non-deprecated attach nodes. In the UE4 documentation here: SkeletalMeshSockets | Unreal Engine Documentation

It shows what the others look like for me (the deprecated ones) so they’re also not helpful.

In this case I can do two things:

1 - In the BaseGun Actor Blueprint: Attach the SkeletalMeshComponent “Gun” to the passed in Mesh and specify the hand socket with which to attach to. In this case, though, I’d rather attach the entire BaseGun actor there. As shown, no difference in inputs exists between the two nodes. If needed I could even replace the SceneRoot with the Gun SkeletalMeshComponent but in this case it’s unwarranted.

2 - In the Weapon-Picker-Upper Actor Blueprint I can attach the Weapon-Picker-Upper Actor (or its Mesh) to the Grip Socket of the Gun but in this case the Gun wouldn’t animate with the player or w/e is attached to it. Haven’t attempted this because it shouldn’t work given that the attach to node is meant to attach one thing to another; not combine - Similar to networking, for movement, one of them is the authority.

Once more, what I’m trying to attempt is Socket to Socket attachment; I do realize that manual adjustments can be made to the Gun Component within its Blueprint Viewport or within Persona in order to offset it, thus removing the need for this for single-handed holding of weapons, but I still have the following problems that go unsolved in this case:

  1. Two handed weapons. Rifles, Swords, ect.
  2. “Pulling” switches on the wall where I’d have the Switch animated in a Timeline, Sequencer/Matinee, Curve, ect. Blueprint and simply want the hand to hold onto the lever while the lever “animates”.

I’m sure that there are more things than this that having Socket to Socket attachments would be useful for. Workarounds exist to an extent but at the very least are, comparatively, time consuming.

Edit: May not be clear: What I can do currently is attach my Actor or one of its components at its Origin, Relative, or Scaled location, rotation, and scale TO my Character’s Mesh Component at that Mesh Component’s Socket (in this case the hand). What I’d like to do is be able to attach my Actor (or Gun Component after making it the Root Component) at its Socket (GripSocket) TO my Character’s Mesh Component at that Mesh Component’s Socket (hand_r).

And even if I can do this, I’m not entirely sure if that solves the lever pulling. Though I’m sure that it does (assuming I prevent the player from activating the lever outside of X rotation/location and prevent their inputs until the lever is done and their hand is no longer attached to the lever’s socket).

Edit 2: I also happen to have very different types of actors I’m attaching these weapons to. Using an offset for the initial placement would work but two handed weapons ect. falls apart from there. It’s possible to place arrow components or Vector + Rotation arrays/structs in every single WeaponUser Interface Implementing actor for every single weapon, lever, ect. but it seems like quite a poor workflow. Add to that that I’d need to frequently be checking ingame, per actor, per weapon, that each of these offsets in all of the animations look more or less appropriate in their alignment and… wow. It gets awful.