Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- skill system
- 13iew
- register component
- 리디렉션 크래쉬
- deltaTime
- unreal engine
- tscriptinterface
- 리디렉터 크래쉬
- UE4
- redirection crash
- Ai
- ue4 error
- UnrealEngine
- Unreal Engine 4
- unreal engine skill
- 언리얼
- 랜덤 맵 생성
- Unreal Engine Error
- Random Map Generator
- UE
- LittleNightMare
- unreal engine redirection crash
- unity
- change textblock color
- UE5
- ue4 Crash
- splinemeshcomponent scale
- Unreal Engine 5
- staticmesh mobility
- redirector crash
Archives
- Today
- Total
Class GameDev* SheepAdult
[Unreal Engine 5] MoveToLocation 반환 값을 통한 상황 판단 (EPathFollowingRequestResult) 본문
Unreal Engine
[Unreal Engine 5] MoveToLocation 반환 값을 통한 상황 판단 (EPathFollowingRequestResult)
SheepAdult 2024. 8. 20. 22:10AI를 서버를 통해 움직일 때 목표 위치까지 움직인 후 어떤 동작을 정의할 때 사용하는 Enum 이 있다. AI를 움직일 때 사용하는 MoveToLocation() 함수의 반환 값인 EPathFollowingRequestResult이다. 참고로 header는 아래와 같다.
#include "Navigation/PathFollowingComponent.h"
엔진의 헤더 파일에는 아래와 같이 정의 되어 있다.
보통 언리얼 엔진 파일들에는 주석이 적혀 있는데 주석이 없다. 자료가 많진 않지만 긁어모은 정보는 아래와 같다.
- Failed: 경로 탐색이 실패할 경우.
- AlreadyAtGoal: AI가 이미 목표 지점에 도착했을 경우.
- RequestSuccessful: 경로 탐색이 성공적으로 시작된 경우. 즉, 움직이기 시작한다.
이를 바탕으로 아래와 같은 테스트 코드를 짰다.
...
FVector TargetLocation = FVector(TargetInfo->x(), TargetInfo->y(), GetActorLocation().Z);
AAIController* AIEnemyController = Cast<AAIController>(GetController());
float CapsuleRadius = GetCapsuleComponent()->GetScaledCapsuleRadius();
if (AIEnemyController == nullptr)
return;
EPathFollowingRequestResult::Type Result = AIEnemyController->MoveToLocation(TargetLocation, CapsuleRadius);
// 상황에 맞는 코드를 넣으면 될 것 같다.
switch (Result)
{
case EPathFollowingRequestResult::AlreadyAtGoal:
{
FRotator TargetRotation = FRotator(GetActorRotation().Pitch, TargetInfo->yaw(), GetActorRotation().Roll);
FRotator NextRotation = FMath::RInterpTo(GetActorRotation(), TargetRotation, DeltaTime, 10);
SetActorRotation(NextRotation);
}
break;
...
...
...
default:
break;
}
...
'Unreal Engine' 카테고리의 다른 글
[Unreal Engine] RegisterComponent 주의점 (0) | 2025.01.28 |
---|---|
[Unreal Engine 5] Runtime에 TextBlock 색상 변경하기 (Changing Widget TextBlock Color at Runtime) (0) | 2024.08.29 |
[Unreal Engine 5] Actor가 Spawn되기 전에 Actor 정보 세팅하기 (0) | 2024.08.04 |
[Unreal Engine 5] Interface Execute_ 시 Debug Break 에러 (0) | 2024.07.15 |
[Unreal Engien 5] Optimization - Skeletal Mesh 병합을 통한 Draw Call(드로우 콜) 감소 (1) | 2024.05.18 |