Hi.
I've got a ACharacter (SamuraiCharacter) and also an AActor (Weapon.cpp). The Weapon class is the base class for a number of blueprints each representing a different weapon.
In the Weapon class I get hold of the PlayerCharacter and the CharacterMesh and I access the right hand socket.
My question and issue is looking at the Actor class api on unreal there is an AttachToActor and AttachToComponent function.
In BeginPlay in Weapon.cpp I've tried:
AttachToActor(CharacterMesh, EAttachLocation::SnapToTargetIncludingScale, TEXT("Right_Hand_Object_Socket"));
Understandably I get an error because CharacterMesh is of type USkeletalMeshComponent and it's expecting an AActor.
And the reason I'm hoping to do this from within the Weapon class and not the SamuraiCharacter class is because in the Samurai class i'd have to somehow get a reference to each separate weapon blueprint and I find that harder to do.
Thx.
I've got a ACharacter (SamuraiCharacter) and also an AActor (Weapon.cpp). The Weapon class is the base class for a number of blueprints each representing a different weapon.
In the Weapon class I get hold of the PlayerCharacter and the CharacterMesh and I access the right hand socket.
My question and issue is looking at the Actor class api on unreal there is an AttachToActor and AttachToComponent function.
In BeginPlay in Weapon.cpp I've tried:
AttachToActor(CharacterMesh, EAttachLocation::SnapToTargetIncludingScale, TEXT("Right_Hand_Object_Socket"));
Understandably I get an error because CharacterMesh is of type USkeletalMeshComponent and it's expecting an AActor.
And the reason I'm hoping to do this from within the Weapon class and not the SamuraiCharacter class is because in the Samurai class i'd have to somehow get a reference to each separate weapon blueprint and I find that harder to do.
Thx.
Comment