欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

UE4蓝图转C++:节点转换(持续更新)

程序员文章站 2022-03-12 17:11:28
...

UE4蓝图转C++:节点转换

  1. OnComponentBeginOverlap

UE4蓝图转C++:节点转换(持续更新)

(1)首先在头文件中(本人是PlayerCharacterBase.h)声明重叠绑定的函数,函数名任意,参数按照蓝图

UFUNCTION()
	void OnOverlap( UPrimitiveComponent* OverlappedComponent,  AActor* OtherActor,  UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepHit);

(2)然后在SetupPlayerInputComponent函数中绑定

void APlayerCharacterBase::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    	WeaponCollision->OnComponentBeginOverlap.AddDynamic(this,&APlayerCharacterBase::OnOverlap);
}

(3)在PlayerCharacterBase.CPP中定义

相关标签: 虚幻4