标签:
OnComponentBeginOverlap事件
当物体有碰撞体,同事碰撞类型设置为OverlapAll时,会触发,同时角色不会被挡住。
这是文档中的OnComponentBeginOverlap的案例代码
// set up a notification for when this component overlaps something CollisionSphere->OnComponentBeginOverlap.AddDynamic(this, &ALightSwitchCodeOnly::OnOverlapBegin); void ALightSwitchCodeOnly::OnOverlapBegin(class AActor* OtherActor, class 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); } }
标签:
原文地址:http://www.cnblogs.com/blueroses/p/5187174.html