#memo

indiedev太郎

NavMesh周りやる

NavMesh絶対しんどい、即死
箇条書き、即死


AAIController

AAIController::MoveTo
FAIMoveRequest型のMoveRequestを渡す
引数が正常か、もうゴールに到達してるかをチェックして、移動できるようであれば
1. FPathFindingQuery型のQueryを用意する
2. AAIController::PreparePathfinding関数を実行

AAIController::PreparePathfinding
1. 最新のUNavigationSystemを取得
2. ANavigationData* NavDataにNavSys->GetNavDataForProps(GetNavAgentPropertiesRef());


ANavigationData : AActor
TArray<FNavPathPoint> PathPoints;
TWeakObjectPtr<AActor> Base;

FPathFindingResult FindPath(const FNavAgentProperties& AgentProperties, const FPathFindingQuery& Query)
インライン関数


FPathFindingResult
FNavPathSharedPtr Path;
ENavigationQueryResult::Type Result;

検索したPath、その成否の構造体


FNavPathSharedPtr

FNavigationPathのスマートポインタ


FNavigationPath
TArray<FNavPathPoint> PathPoints;

Unreal Engine | FNavigationPath


FNavLocation

FVector Location;
NavNodeRef(uint64) NodeRef;

FNavPathPoint

FNavLocationを少し拡張

FPathFindingQueryData
TWeakObjectPtr<const UObject> Owner;
FVector StartLocation;
FVector EndLocation;
FSharedConstNavQueryFilter QueryFilter;
FNavAgentProperties NavAgentProperties;
int32 NavDataFlags;
uint32 bAllowPartialPaths : 1;
FPathFindingQuery : public FPathFindingQueryData
TWeakObjectPtr<const ANavigationData> NavData;
FNavPathSharedPtr PathInstanceToFill;
FNavAgentProperties NavAgentProperties;
FAIMoveRequest

AITypes.hで定義されている構造体
メンバ変数は
・AActor* GoalActor
・FVector GoalLocation
あとこまごまで、目的地を指定するかんじである
Unreal Engine | FAIMoveRequest

UNavigationSystem : public UBlueprintFunctionLibrary

Unreal Engine | UNavigationSystem


UNavigationSystem::FindPathToLocationSynchronously

FPathFindingResult UNavigationSystem::FindPathSync(FPathFindingQuery Query, EPathFindingMode::Type Mode)
Result = Query.NavData->FindPath(Query.NavAgentProperties, Query);

PathFollowingComponent


dtNavMeshQuery

ここに具体的な経路探索のアルゴリズムやらなんやらが

Unreal Engine | dtNavMeshQuery


ARecastNavMesh : public ANavigationData

honmei



<NavigationTypes.h>

FMovementProperties
uint32 bCanCrouch:1;
uint32 bCanJump:1;
...

AIがしゃがんだり泳いだりできるのかどうかやらを記す構造体


FNavAgentProperties : public FMovementProperties
float AgentRadius;
float AgentHeight;
float AgentStepHeight;
...

AIの移動性能とかを記す構造体


FNavDataConfig : public FNavAgentProperties
FName Name;
FColor Color;
TSubclassOf<ANavigationData> NavigationDataClass;
...

実際に使用するnavmeshのクラスや色やらを設定する構造体
NavigationSystemでは、RecastNavMeshがNavigationDataClassとされておる


わかrないでうs