UE4蓝图转C++:节点转换(持续更新)
程序员文章站
2022-03-12 17:11:28
...
UE4蓝图转C++:节点转换
- OnComponentBeginOverlap
(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中定义
推荐阅读