**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
i noticed the comments but still confused about the if sentence.
whats the “OtherComp” inside it means?
and whats the every single parameter of OnComponentBeginOverlap function means?
btw where i can find a description of every built-in function like OnComponentBeginOverlap when get stuck?
If docs dont answer - your best bet is to simply check the source code for the function. It is easy to do this in Visual Studio. I cannot emphasize this point enough - the source is teh ultimate documentation. Well worth your effort in researching…
A second strategy is to put a breakpoint and inspect the variables at runtime. Also a good tool.
But to answer your question directly :
The overlap occurs between 2 bodies. The first body is the one that is owned by the actor (eg this pointer). The specific component on the actor is OtherComp.
The other actor is OtherActor.
The component on the other actor is OtherComp.
SweepResult is a HitResult that contains a ton of collision info.