2024-04-15
깃허브! |
---|
https://github.com/ChangJin-Lee/ARproject |
★ https://github.com/ChangJin-Lee/ToonTank |
느낀점
언리얼에서 사용하는 델리게이트 개념을 배울 수 있었다. 콜백함수로 함수의 주소를 전달하여 사용하는 방법도 매우 신기했다. 어떤 이벤트가 발생했을때 Broadcast한다는 개념이 신기했다.
void AProjectile::BeginPlay()
{
Super::BeginPlay();
ProjectileMesh->OnComponentHit.AddDynamic(this, &AProjectile::OnHit);
}
// Sets default values
AProjectile::AProjectile()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
ProjectileMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Projectile Mesh"));
RootComponent = ProjectileMesh;
ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileMovement"));
ProjectileMovement->InitialSpeed = ProjectileInitialSpeed;
ProjectileMovement->MaxSpeed = ProjectileMaxSpeed;
}
https://forums.unrealengine.com/t/oncomponenthit-function-not-working/483103