I need help with weapons, animations and sockets!





Hey everybody! How are you?
Well, Im trying to solve this problem with my guns. I retargeted a couple of animations from another character (Wraith) to Twin Blast because my game allows the player to change weapons and pick up another guns, some duals guns and some individual assault rifles or smg. Im using sockets to attach my cpp class “Weapon”.
I set the socket correctly for the original character animations. The problem is that when I use other animations I would have to correct the transformation of the socket but doing that causes the sockets to stop being correctly placed in the original animations.

image

When I add a new socket at the “Hand_l or Hand_r” bones the socket automatically sticks to “Ik_hand_gun”. Someone can help me? and if you have a better idea to do this I would appreciate it if you shared it with me. Thank you!!

Are you able to change the bone in the details panel on the right?
image

Hey Ty! Thank you for your answer! Im attaching my weapon on c++.
My character blueprint is sabed on c++ class:
image

And that’s why Im not able to do what you say.
Now Im thinking about create sockets for every gun of the game. I don’t like that idea, I would like to create something more generic to adapt the socket to differents gun but well. What do you think about that?

Sorry I should have clarified. The screenshot I posted is from the skeleton.

Is your issue that the slot automatically assigns below the ik_hand_gun bone? That’s what I am assuming given your last line of text. Your previous reply makes me thing you have an issue with initial transform of the gun itself instead of sockets. I have a solution for that if that is the case.

Into the skeleton editor I get this so the socket was attached correctly:
image

I was confused about that because I was looking the another section:

haha, sorry. But know I just can create new sockets (with their corrects locations and rotations) for every gun and with code get the info of what type of gun my character is wielding and send that to the animation blueprint. Do you know another way to do that? Obviously in my case im using animations from other skeleton, similar but not the same skeleton at the end

So I’m going off of the assumption that you are attaching meshes to the sockets. What I would do instead is create blueprints for each of your guns and use a scene component to offset the mesh by whatever offset you need rather than creating a million sockets.

So you could use a child actor or simply spawn the actor class and attach to the socket. The gun bp itself would manage the placement away from the origin of the root scene component.

Yes, probably you are right because the black and yellow smg from Belica’s skeleton has a little problems with its bones and its collision. I need to redo that. Of course Im doing this from “scratch” but I didn’t find some plugin or something do you know some plugin for doing this?

Let me show my code. Im attaching a bp gun based on c++ gun class:

My Gun class cpp has:
UPrimitiveComponent (Im using this to manipulate my guns physics)
USphereComponent
USkeletalMeshComponent

And It has its own projectile subclass.

Can I see your Gun BP?

That’s my bp gun (smg).

image

image
Unable to put some parent socket because theres not a skeleton to use.

Okay so instead of making a bunch of sockets for the offset…

Add a scene component to your gun bp. Make that the root. Then move the gun mesh to the correct placement to match where it needs to be on the single socket