Source/SimpleShooter/ShooterCharacter.cpp
// Called when the game starts or when spawned
Called when the game starts or when spawned
Called when the game starts or when spawned
void AShooterCharacter::BeginPlay()
{
    Super::BeginPlay();
    Health = MaxHealth;
    Gun = GetWorld()->SpawnActor<AGun>(GunClass);
    GetMesh()->HideBoneByName(TEXT("weapon_r"), EPhysBodyOp::PBO_None);
    Gun->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepRelativeTransform, TEXT("WeaponSocket"));
    Gun->SetOwner(this);
}
void AShooterCharacter :: BeginPlay ( ) { Super :: BeginPlay ( ) ; Health = MaxHealth ; Gun = GetWorld ( ) -> SpawnActor < AGun > ( GunClass ) ; GetMesh ( ) -> HideBoneByName ( TEXT ( " " ) , EPhysBodyOp :: PBO_None ) ; Gun -> AttachToComponent ( GetMesh ( ) , FAttachmentTransformRules :: KeepRelativeTransform , TEXT ( " " ) ) ; Gun -> SetOwner ( this ) ; }
Called when the game starts or when spawned
Called when the game starts or when spawned