Third person weapon mesh visibility in shooter game

For some reason when I port the weapon and character code over from shooter game to a new project and use the same assets, my third person weapon mesh is always visible when the pawn is possessed by the player. It doesn’t rotate with the rig or anything it just stays in place like it’s not attached to any socket.

From my understanding the attachment logic and mesh visibility is handled :

void AGOWWeapon::AttachMeshToPawn()
	if (MyPawn)
		// Remove and hide both first and third person meshes

		// For locally controller players we attach both weapons and let the bOnlyOwnerSee, bOwnerNoSee flags deal with visibility.
		FName AttachPoint = MyPawn->GetWeaponAttachPoint();
		if (MyPawn->IsLocallyControlled() == true)
			USkeletalMeshComponent* PawnMesh1p = MyPawn->GetSpecifcPawnMesh(true);
			USkeletalMeshComponent* PawnMesh3p = MyPawn->GetSpecifcPawnMesh(false);
			Mesh1P->AttachTo(PawnMesh1p, AttachPoint);
			Mesh3P->AttachTo(PawnMesh3p, AttachPoint);
			USkeletalMeshComponent* UseWeaponMesh = GetWeaponMesh();
			USkeletalMeshComponent* UsePawnMesh = MyPawn->GetPawnMesh();
			UseWeaponMesh->AttachTo(UsePawnMesh, AttachPoint);

And it really just depends on whether the pawn mesh is visible or not. Is there something else happening in the shootergame source that enables the third person mesh to be hidden?


The visibility of the third and the first person weapon mesh is set with the help of OnlyOwnerSee and OwnerNoSee flags.

Recently I encountered similar problem which was caused by messing with Owner variable. You should check Owner of weapon actor. It looks like if you just attach some other mesh to character and do not setup a new Owner variable it may cause some troubles.
There is a function in shooter game example:

void AShooterWeapon::OnEnterInventory(AShooterCharacter* NewOwner)

void AShooterWeapon::SetOwningPawn(AShooterCharacter* NewOwner)
	if (MyPawn != NewOwner)
		Instigator = NewOwner;
		MyPawn = NewOwner;
		// net owner for RPC calls

Also dont forget to check Collision settings of you weapon actor.