Attach component to component breaks the character movement, unless I'm aiming?

Hello,

I’m in the process of learning UE and I’ve gotten pretty far but I’m stuck on this. I’m following a new tutorial for an inventory system. I can put items on the map, pick them up, save them, etc.

The last part was equiping an item, in this case, a gun. All of that works well, but when I equip the weapon the character movement goes weird. Like it’s being pulled to one side, kinda.

So, for testing pressing 1 equips the pistol:

This is the equip function:

For what I can tell, everything is ok here.

This is the AttachChild function:

The problem seems to be there, somewhere, somehow. If I unplug this everything works but, obviously, the character doesn’t equip the pistol.

Now, personally, in my very limited knowledge, that attach component to component seems a bit weird, but I don’t know enough to know why.

I have a small video that might explain things better. First the movement is good. I pick up the gun, all good. Then I equip it by pressing 1. Still all good. But then you’ll see that the movement is weird, UNLESS I aim… and that confuses me even more. I have a whole other section of blueprints that deals with aiming but I think it shouldn’t have to do anything with this?

I’m very confused, and at the same time I have a feeling it’s a silly mistake on my part.

Any and all help would be greatly appreciated!!

First off you should be using Attach Actor (gun) to Component (character mesh).
Second, attach actors cannot have collision that blocks the pawn capsule. It interferes with character movement.

1 Like

Ok, the collision was my first thought, so I’m pretty sure (again, new at this) that I deactivated that. Attach Actor to Component does make a lot more sense to me. I’ll try that and report back! Thank you!