首页 > 其他 > 详细

最近想写一个类似鬼泣 收集红魂的功能,陆续写点东西作为笔记

时间:2016-02-12 18:38:07      阅读:168      评论:0      收藏:0      [点我收藏+]

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!