OnComponentBeginOverlap

Event called when something starts to overlaps this component, for example a player walking into a trigger.

Windows
MacOS
Linux

Syntax

FComponentBeginOverlapSignature OnComponentBeginOverlap

Remarks

Event called when something starts to overlaps this component, for example a player walking into a trigger. For events when objects have a blocking collision, for example a player hitting a wall, see 'Hit' events.

Both this component and the other one must have GetGenerateOverlapEvents() set to true to generate overlap events.

When receiving an overlap from another object's movement, the directions of 'Hit.Normal' and 'Hit.ImpactNormal' will be adjusted to indicate force from the other object against this object.

Example Code

LightSwitchCodeOnly.cpp at line 25:

    // set up a notification for when this component overlaps something  
    CollisionSphere->OnComponentBeginOverlap.AddDynamic(this, &ALightSwitchCodeOnly::OnOverlapBegin);  

LightSwitchCodeOnly.cpp at line 40:

void ALightSwitchCodeOnly::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)  
{  
    // Other Actor is the actor that triggered the event. Check that is not ourself.  
    if ( (OtherActor != nullptr ) && (OtherActor != this) && ( OtherComp != nullptr ) )  
    {  
        // Turn off the light  
        PointLight->SetVisibility(false);  
    }  
}
Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback