AActor::NotifyActorEndOverlap

Event when an actor no longer overlaps another actor, and they have separated.

Windows
MacOS
Linux

Override Hierarchy

AActor::NotifyActorEndOverlap()

ACharacter::NotifyActorEndOverlap()

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h

Include

#include "GameFramework/Actor.h"

Source

/Engine/Source/Runtime/Engine/Private/Actor.cpp

Syntax

virtual void NotifyActorEndOverlap
(
    AActor * OtherActor
)

Remarks

Event when an actor no longer overlaps another actor, and they have separated.

Components on both this and the other Actor must have bGenerateOverlapEvents set to true to generate overlap events.

Example Code

MyComponentSpawner.cpp at line 45:

void AMyComponentSpawner::NotifyActorEndOverlap(class AActor* OtherActor)  
{  
    Super::NotifyActorEndOverlap(OtherActor);  

    // When we detect that we are overlapping with another actor we create a new component  
    // above us, this is then removed when an actor leaves.  

    // Other Actor is the actor that triggered the event. Check that is not ourself.  
    if (OtherActor && (OtherActor != this))  
    {  
        //Find all the static mesh components attached to the RootComponent  
        TArray<UStaticMeshComponent*> StaticMeshComponents;  
        for (USceneComponent* Comp : RootComponent->GetAttachChildren())  
        {  
            if (UStaticMeshComponent* MeshComp = Cast<UStaticMeshComponent>(Comp))  
            {  
                StaticMeshComponents.Add(MeshComp);  
            }  
        }  

        //Destroy them  
        for (UStaticMeshComponent* Comp : StaticMeshComponents)  
        {  
            Comp->DestroyComponent();  
        }  
    }  
}
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