[Need Help] Taking object from inventory to my Character's hand (spawn of and attach him to an actor

Hi everyone,

I have a problem and i hope someone can help me with him.
I’ve made an inventory system with a structure of variable for my object created (following a tutorial).

I want to had object in specified socket when an action is executed.

Here is the result i want, i’ve done this, but not when i press a button or realise an action.

My structure look like this :

I’ve made a socket with this name “objet_saisi2” :

structure item.png

I have the idea to use “spawn actor” for create a new instance of my object choosen (i don’t know if it’s a good idea), and continue the code with an “attach actor to component”, like this:

My object spawn, but not in the hand of my character, not on the specified socket in “attach actor to component”.
The object just spawn in the space.

I would appreciate some help if someone find where come from the problem.
Thanks in advance.

Maybe i only can resolve my problem in C++ ? And i can’t do that in blueprint ?

UPpppppp pp

I don’t know if this is of any help, but since there’s not much else going on here…
Instead of the “attach to actor”, which I guess should work, have you tried to use “attach to component (target is Actor)” (there are two types) instead?
Where Target is your gun Actor, Parent is the mesh and with the appropriate socket name.
If that does not work, try the “attach to component (target is scene component)”, where target is the gun component of the gun actor.

Thanks for your reply.
I’ve test all “attach” but no one works, but my spawn actor work, my weapon spawn always to the same location.
My weapon spawn in the space, but he’s not attach to my socket, and the socket name is good

If i had manually my gun to my static mesh where i have my socket it work, but when i try on the blueprint for taking my weapon from my inventory it doesn’t work.

and with the gun:

c02ef6a6f1faf958fe779181d59ec810a8ed99e2.jpeg

So I made this simple setup, and both the attach to Actor and Attach to component nodes work, though notice their difference.


*bad screenshot, the “none” text inside the attach to actor node actually says Left Shoulder like the one below.
The upper one is the attach to actor, the lower is attach to component.

I checked by spawning a cable component, a character and a static mesh and they all get attached.
The only reason you see it spawning at the socket space, is because that’s what you are setting its transforms to. So don’t get confused about that, may want to spawn it at 0,0,0. It should snap to the socket since you have that selected.

Actually, is this happening inside a widget? Perhaps during a drag & drop event?
Could you do a is valid check of your character reference?

I’ve done all my blueprint inside my Inventory Blueprint not on my character Blueprint.
The problem can be that ?
I will test your code

What function who call “Transform” did you use ?

HE doesn’t work for me…

Is the Inventory Blueprint a widget? In any case, I doubt that it is the problem, but I have met some bugs with widgets.
This is a really tricky one, its such a basic setup and I’m getting it to work. I’m not seeing what is different from your setup.
but I think you’ll want to use the “attach to component (target is actor)” instead of the “attach to actor”.

Just drag off the “spawn transform” pin and click the “make transform”, near the bottom of the list.

For any case, it doesn’t work for me, i don’t know why, i have the same thinks …

What i can tell you is the weapon always spawn in the same place

I spawn the object now from my socket just making another, making a BP direct in the clas on spawn actor.
But the objet don’t stay to my socket

How about going real minimalistic and go up to see where things go wrong.
Create a new actor and add a cone component inside that actor. Disable its collision.
Then inside the player character, create the following setup, but with your socket name.
Note that the parent need to be the mesh.

Does that work? Does a cone spawn and attach to the hand socket?
If so, change the class to your gun class. Does that work?

I’ve found something, it’s maybe because it’s a blueprint and not just a static mesh for exemple.
So how i can change that ?

I’ve test just with a gun but not my BlueprintGun, and that doesn’t work for my blueprint gun

I’ve found the problem.
It’s from my weapon blueprint.
The problem is here :

I need to move my skeletal mesh in my blueprint out of the “itemMasterPhysics” and it works.
But if i do that, my weapon doesn’t have physics, and he appears on the bode of my character, no like i want in the socket.

The cone I attach is an actor (blueprint) too, so that’s not the problem. Yes, you can go with a static mesh instead of an actor, but if you want each gun instance to have say durability or other instance unique properties, an actor may be a good way to go.

So the gun actually has a capsule, it’s a character? That explains that then. Not that I understand why it does. Try disabling gravity for both the capsules. But you may run into issues with this kind of setup down the road.
Not that I know how to do a ‘character holding a gun’ system, haven’t tried that yet.