UPrimitiveComponent::OnComponentBeginOverlap
#include "Components/PrimitiveComponent.h"
Access: public
Specifiers: UPROPERTYBlueprintAssignable
Description
Delegate fired when another component begins overlapping this component. Requires both components to have overlap responses enabled for the relevant channels.
Signature
FComponentBeginOverlapSignature OnComponentBeginOverlap Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OverlappedComponent | UPrimitiveComponent* | This component. | — |
| OtherActor | AActor* | The actor that began overlapping. | — |
| OtherComp | UPrimitiveComponent* | The specific component on the other actor. | — |
| OtherBodyIndex | int32 | Index of the physics body (relevant for skeletal meshes with multiple bodies). | — |
| bFromSweep | bool | True if the overlap was detected via a sweep (movement), false if via a proximity check. | — |
| SweepResult | const FHitResult& | Hit result from the sweep, valid only when bFromSweep is true. | — |
Caveats & Gotchas
- • Both components must respond to each other's object type with ECR_Overlap (not ECR_Block or ECR_Ignore) for the event to fire.
- • Actor-level overlap events (AActor::OnActorBeginOverlap) are fired after the component-level event. Use the component version when you need the specific component reference.
- • Dynamically spawned actors may fire OnComponentBeginOverlap during BeginPlay if they spawn inside an existing overlapping volume — handle this case explicitly.
Example
Trigger zone that applies a speed boost C++
void ASpeedZone::BeginPlay()
{
Super::BeginPlay();
TriggerVolume->OnComponentBeginOverlap.AddDynamic(this, &ASpeedZone::OnOverlapBegin);
TriggerVolume->OnComponentEndOverlap.AddDynamic(this, &ASpeedZone::OnOverlapEnd);
}
void ASpeedZone::OnOverlapBegin(UPrimitiveComponent* Comp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& Hit)
{
if (ACharacter* Char = Cast<ACharacter>(OtherActor))
{
Char->GetCharacterMovement()->MaxWalkSpeed *= 2.0f;
}
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?