void UBTService_ForcusTarget::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)

{

Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);


auto Controller = Cast<APSAIController>(OwnerComp.GetAIOwner());

APSCharacter* Character = Cast<APSCharacter>(UGameplayStatics::GetPlayerPawn(this, 0));


Controller->GetBlackboard()->SetValueAsVector(APSAIController::TargetLocationKey, Character->GetActorLocation());

Controller->GetBlackboard()->SetValueAsObject(APSAIController::TargetKey, Character);


auto PSEnemy = Cast<APSEnemy>(OwnerComp.GetAIOwner()->GetPawn());

auto Target = Cast<APSCharacter>(OwnerComp.GetBlackboardComponent()->GetValueAsObject(APSAIController::TargetKey));



FVector LookVector = Target->GetActorLocation() - PSEnemy->GetActorLocation();


LookVector.Z = 0.0f;

FRotator TargetRot = FRotationMatrix::MakeFromX(LookVector).Rotator();

PSEnemy->SetActorRotation(TargetRot);

}



a16711aa372a76b660b8f68b12d21a1dd283d836c6



์ด๊ฒŒ ์ „๋ถ€์ž„


์ด๋ ‡๊ฒŒํ•˜๋ฉด ai๋Š” ํ•ญ์ƒ ์œ ์ €๋ฅผ ๋ฐ”๋ผ๋ด„. ๊ณ„์† ์‹œ์„ ์€ ๋”ฐ๋ผ์˜ด
๊ทผ๋ฐ ์ด๋™ํ• ๋•Œ ์•ฝ๊ฐ„ ๋ญ๋ผํ•ด์•ผํ• ๊นŒ ํฌ์ธํŠธ ์ฐ๊ณ  ์ด๋™ํ•œ๋‹ค๊ณ  ํ•ด์•ผ๋˜๋‚˜ ์ด๋™ํ•˜๋‹ค๊ฐ€ ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๋ฐฉํ–ฅ ํ‹€๋ฉด ์ž ๊น ๋ฉˆ์นซํ•˜๊ณ  ๋”ฐ๋ผ๊ฐ€๊ณ  ์กฐ๊ธˆ ๊ฐ๋ชฉ์ฒ˜๋Ÿผ ์›€์ง์ž„
์˜์ƒ์ฒจ๋ถ€์•ˆ๋˜๋Š” ์‹œ๊ฐ„๋Œ€๋ผ ์•„์‰ฝ๋‹ค ใ… ํ“จ