UnrealScripterAI
Discord ↗
Link Copied to Clipboard
×
"creates an enemy dectection trigger"
AEnemyTrigger::AEnemyTrigger() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; DetectionSphere = CreateDefaultSubobject<USphereComponent>(TEXT("Detection Sphere Component")); DetectionSphere->InitSphereRadius(500.0f); DetectionSphere->SetCollisionProfileName(TEXT("Trigger")); DetectionSphere->SetupAttachment(RootComponent); DetectionSphere->OnComponentBeginOverlap.AddDynamic(this, &AEnemyTrigger::OnOverlapBegin); DetectionSphere->OnComponentEndOverlap.AddDynamic(this, &AEnemyTrigger::OnOverlapEnd); }