当前位置: 代码迷 >> 综合 >> Unreal Engine 4 —— GAS系统学习 (三十四)群体技能GroundBlast(2)
  详细解决方案

Unreal Engine 4 —— GAS系统学习 (三十四)群体技能GroundBlast(2)

热度:51   发布时间:2024-02-20 15:06:59.0

欢迎大家加入Unreal Engine C++ & Blueprint群一起交流:1143575617

上一节中我们完成射线,但还是不够,既然是群体技能,一定有一个打击范围,我们今天来完成打击范围内的敌人统计工作。

打开GATargetData的C++文件。

在头文件中新建一个方法和一个变量备用。

	UFUNCTION(BlueprintCallable, Category = "TargetDataSelected")bool GetLookAtLocation(FVector& viewPoint);UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "TargetDataSelected")float Radius;

这个方法是打算将上一节的射线检测的内容放进去。

打开CPP文件。

将上一节的射线检测内容放入到新的函数中。这样做是方便功能管理。

bool AGATargetActor::GetLookAtLocation(FVector& viewPoint)
{AShibiCharacter* shinbi = Cast<AShibiCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn());FVector ViewStartLocation;FRotator ViewRotation;playerController->GetPlayerViewPoint(ViewStartLocation, ViewRotation);FHitResult hit;FCollisionQueryParams Params;if (Ma
  相关解决方案