AActor::NotifyActorBeginOverlap
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called when any component of this actor begins overlapping any component of another actor. Override to respond to actor-level overlap begin events in C++.
Caveats & Gotchas
- • Both actors' overlapping components must have bGenerateOverlapEvents set to true, otherwise this notification is never sent. This is the most common reason overlaps are silently missed.
- • NotifyActorBeginOverlap fires once per unique actor pair, not once per overlapping component pair. If two components on the same pair of actors begin overlapping simultaneously, this is still called only once.
- • On clients in a networked game, overlap events are driven locally by the physics simulation; they are not replicated. You may see overlap events on clients that never fire on the server and vice versa.
Signature
ENGINE_API virtual void NotifyActorBeginOverlap(AActor* OtherActor); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OtherActor | AActor* | The other actor whose component began overlapping a component of this actor. | — |
Return Type
void Example
Override to detect player entry C++
void AMyTriggerActor::NotifyActorBeginOverlap(AActor* OtherActor)
{
Super::NotifyActorBeginOverlap(OtherActor);
if (ACharacter* Character = Cast<ACharacter>(OtherActor))
{
ActivateTrigger(Character);
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?