Download

problem with attaching weapon to character

Hi,

I’m testing out a sidescroller/platformer type game and having an issue with the weapon attachment. The weapon is attached to the character’s weapon socket. The problem is that the weapon mesh is pointing downward. = I’ve tried using:

WeaponMesh->AttachTo(PawnMesh, AttachPoint, EAttachLocation::KeepRelativeOffset);

but it’s not working. I want to orient the weapon to the direction of player character.

Untitled.jpg

JB

Try rotating your character’s socket. :slight_smile:

Have a look at EAttachLocation::Type:

https://docs.unrealengine.com/latest/CHN/API/Runtime/Engine/Engine/EAttachLocation__Type/index.html

You should use “SnapToTarget” instead of “KeepRelativeOffset”.

If the weapon doesn’t match up after that go ahead and rotate your socket as gregdumb suggested.

Ahh. I tried “SnapToTarget” and that had the same effect as "KeepRelativeOffset. I’ll try to rotate the socket as gregdumb suggested. Thanx.

Update:
Rotating the “socket” worked like a charm. Thanx a bunch!

JB

No problemo :slight_smile: