UnrealScripterAI
Discord ↗
Link Copied to Clipboard
×
"door that opens when the player comes close and has a trigger volume"
// Create a trigger volume and set its size BoxTrigger = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxTrigger")); BoxTrigger->SetBoxExtent(FVector(60, 60, 20)); // Attach the trigger volume to the door and set its location BoxTrigger->AttachToComponent(GetRootComponent(), FAttachmentTransformRules::KeepRelativeTransform); BoxTrigger->SetRelativeLocation(FVector(0, 0, 60)); // Add OnActorBeginOverlap event to the trigger volume BoxTrigger->OnComponentBeginOverlap.AddDynamic(this, &ADoor::OnOverlapBegin);