本文整理汇总了C++中APawn::GetNavAgentPropertiesRef方法的典型用法代码示例。如果您正苦于以下问题:C++ APawn::GetNavAgentPropertiesRef方法的具体用法?C++ APawn::GetNavAgentPropertiesRef怎么用?C++ APawn::GetNavAgentPropertiesRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APawn
的用法示例。
在下文中一共展示了APawn::GetNavAgentPropertiesRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CollectData
void FGameplayDebuggerCategory_Navmesh::CollectData(APlayerController* OwnerPC, AActor* DebugActor)
{
#if WITH_RECAST
ARecastNavMesh* NavData = nullptr;
APawn* PlayerPawn = OwnerPC ? OwnerPC->GetPawnOrSpectator() : nullptr;
APawn* DebugActorAsPawn = Cast<APawn>(DebugActor);
APawn* DestPawn = DebugActorAsPawn ? DebugActorAsPawn : PlayerPawn;
if (DestPawn)
{
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(OwnerPC->GetWorld());
const FNavAgentProperties& NavAgentProperties = DestPawn->GetNavAgentPropertiesRef();
NavData = Cast<ARecastNavMesh>(NavSys->GetNavDataForProps(NavAgentProperties));
}
if (NavData)
{
// add 3x3 neighborhood of target
const FVector TargetLocation = DestPawn->GetActorLocation();
TArray<int32> TileSet;
int32 TileX = 0;
int32 TileY = 0;
const int32 DeltaX[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 };
const int32 DeltaY[] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
int32 TargetTileX = 0;
int32 TargetTileY = 0;
NavData->GetNavMeshTileXY(TargetLocation, TargetTileX, TargetTileY);
for (int32 Idx = 0; Idx < ARRAY_COUNT(DeltaX); Idx++)
{
const int32 NeiX = TargetTileX + DeltaX[Idx];
const int32 NeiY = TargetTileY + DeltaY[Idx];
NavData->GetNavMeshTilesAt(NeiX, NeiY, TileSet);
}
const int32 DetailFlags =
(1 << static_cast<int32>(ENavMeshDetailFlags::PolyEdges)) |
(1 << static_cast<int32>(ENavMeshDetailFlags::FilledPolys)) |
(1 << static_cast<int32>(ENavMeshDetailFlags::NavLinks));
NavmeshRenderData.GatherData(NavData, DetailFlags, TileSet);
}
#endif // WITH_RECAST
}