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.
I’ve made a socket with this name “objet_saisi2” :
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:
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.
*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.
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.
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.
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.