When attaching weapon to character, character movement breaks,

Hi, something very weird is happening with my blueprints. I wanted to make a weapon and attach it to the character in the third person template project. I created a custom component called RightHand which has its parent socket set to hand_r bone on the skeleton.

I then have a BaseGun blueprint which is supposed to be abstract and has placeholder variables for things like velocity and an abstract bullet object reference (which doesn’t get filled yet).

When I press a button (num pad 1 for now) I spawn in a Musket which inherits BaseGun and sets some of the default values and has its own gun mesh. I then attach this to the RightHand component and set the location type to Snap to Target so that it will stay in the hand. Here is the blueprint:

(Adding/removing the socket name doesn’t affect anything)

The problem is that when I do this the gun goes where I want but the movement of my character is from then on completely messed up. It’s hard to explain but when I press any direction of movement my character moves to the left at a much faster speed than normal. It doesn’t work at all… It seems like this should just work. ,

Hm, how could we narrow down that issue.

  1. Do you get the same issue in a new project by just adding the BaseGun/Musket and attaching it?

  2. Are you getting the same issue if you attach something else, like only a static mesh?

  3. Can you reproduce this issue with any other Actor than the Musket or the BaseGun class?

This is just to make sure that he issue comes from your Gun and not from something else.

1 Like

Well I’ve solved that problem. It turns out that because my gun mesh had collision set to BlockAll by default it was colliding with the character and pushing him out in a line normal to the collision which is why he always moved left and no other direction. This would explain why it still worked when I set the location setting in the Attach to Component block to “Keep world location” instead of Snap to Target… It was never colliding then.

Thanks for the suggestions though eXi!

5 Likes

this didn’t show up until after I restarted editor, drove me bonkers… thanks!

Thanks. your answer solved my similar problem.

I just wanted to say thank you! This solved a problem that was driving me crazy. Have a good holiday season and a better New Year! :smiley:

The exact same thing happened to me as well, setting the gun mesh’s collision to none solved the issue, your post helped! It was crazy!

Thousand thanks! :kissing_heart: