UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RecastNavMesh.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_4
6#include "CoreMinimal.h"
7#endif
10#include "EngineDefines.h"
15#include "NavigationData.h"
16#include "NavMesh/NavMeshPath.h"
17#include "RecastNavMesh.generated.h"
18
19#define RECAST_MAX_SEARCH_NODES 2048
20
21#define RECAST_MIN_TILE_SIZE 300.f
22
23#define RECAST_MAX_AREAS 64
24#define RECAST_DEFAULT_AREA (RECAST_MAX_AREAS - 1)
25#define RECAST_LOW_AREA (RECAST_MAX_AREAS - 2)
26#define RECAST_NULL_AREA 0
27// Note poly costs are still floats in UE so we are using FLT_MAX as unwalkable still.
28// Path CostLimit and Distance are based on FVector::FReal.
29#define RECAST_UNWALKABLE_POLY_COST FLT_MAX
30
31// If set, recast will use async workers for rebuilding tiles in runtime
32// All access to tile data must be guarded with critical sections
33#ifndef RECAST_ASYNC_REBUILDING
34#define RECAST_ASYNC_REBUILDING 1
35#endif
36
37//If set we will time slice the nav regen if RECAST_ASYNC_REBUILDING is 0
38#ifndef ALLOW_TIME_SLICE_NAV_REGEN
39#define ALLOW_TIME_SLICE_NAV_REGEN 0
40#endif
41
42//TIME_SLICE_NAV_REGEN must be 0 if we are async rebuilding recast
43#define TIME_SLICE_NAV_REGEN (ALLOW_TIME_SLICE_NAV_REGEN && !RECAST_ASYNC_REBUILDING)
44
45// LWC_TODO_AI Note we are using int32 here for X and Y which does mean that we could overflow the limit of an int for LWCoords
46// unless fairly large tile sizes are used.As WORLD_MAX is currently in flux until we have a better idea of what we are
47// going to be able to support its probably not worth investing time in this potential issue right now.
48
52class UCanvas;
53class UNavArea;
55class UPrimitiveComponent;
57class ARecastNavMesh;
59class dtNavMesh;
60class dtQueryFilter;
62struct dtMeshTile;
65
66UENUM()
68{
69 // keep in sync with rcRegionPartitioning enum!
70
77}
78
79UENUM()
81{
82 Recast, // Use walkableClimb value to filter
83 None, // Skip slope filtering
84 UseStepHeightFromAgentMaxSlope // Use maximum step height computed from AgentMaxSlope
85};
86
88{
89 unsigned short VertCount = 0;
90 unsigned short PolyCount = 0;
91 unsigned short MaxLinkCount = 0;
92 unsigned short DetailMeshCount = 0;
93 unsigned short DetailVertCount = 0;
94 unsigned short DetailTriCount = 0;
95 unsigned short BvNodeCount = 0;
96 unsigned short OffMeshConCount = 0;
97 unsigned short OffMeshSegConCount = 0;
98 unsigned short ClusterCount = 0;
99 unsigned short OffMeshBase = 0;
100};
101
125
127{
129 inline const int32 SkipStringPulling = (1 << 0);
130
132 inline const int32 GenerateCorridor = (1 << 1);
133
135 inline const uint8 FirstAvailableFlag = 2;
136}
137
138#if WITH_RECAST
140{
142 NavNodeRef ParentRef;
143 FVector::FReal Cost = 0.;
144 FVector::FReal TotalCost = 0.;
146
148 TArray<FVector3f, TInlineAllocator<6> > Verts; // LWC_TODO: Precision loss. Issue here is regarding debug rendering needing to work with FVector3f.
150
151 uint8 bOpenSet : 1;
153 uint8 bModified : 1;
154
155 FRecastDebugPathfindingNode() : PolyRef(0), ParentRef(0), NumVerts(0), bOpenSet(0), bOffMeshLink(0), bModified(0) {}
157
158 inline bool operator==(const NavNodeRef& OtherPolyRef) const { return PolyRef == OtherPolyRef; }
159 inline bool operator==(const FRecastDebugPathfindingNode& Other) const { return PolyRef == Other.PolyRef; }
160 inline friend uint32 GetTypeHash(const FRecastDebugPathfindingNode& Other) { return GetTypeHash(Other.PolyRef); }
161
162 inline FVector::FReal GetHeuristicCost() const { return TotalCost - Cost; }
163};
164
166{
167 enum Type : uint8
168 {
169 Basic = 0x0,
170 BestNode = 0x1,
171 Vertices = 0x2,
172 PathLength = 0x4
173 };
174}
175
177{
180 uint8 Flags;
181
183 FRecastDebugPathfindingData(ERecastDebugPathfindingFlags::Type InFlags) : Flags(InFlags) {}
184};
185
187{
188 enum EOffMeshLinkEnd
189 {
190 OMLE_None = 0x0,
191 OMLE_Left = 0x1,
192 OMLE_Right = 0x2,
194 };
195
196 struct FOffMeshLink
197 {
200 uint8 AreaID;
201 uint8 Direction;
203 bool bIsGenerated;
204 float Radius;
205 float Height;
207 };
208
209#if WITH_NAVMESH_CLUSTER_LINKS
210 struct FCluster
211 {
212 TArray<int32> MeshIndices;
213 };
214
215 struct FClusterLink
216 {
219 };
220#endif // WITH_NAVMESH_CLUSTER_LINKS
221
222// This is an unsupported feature and has not been finished to production quality.
223#if WITH_NAVMESH_SEGMENT_LINKS
224 struct FOffMeshSegment
225 {
226 FVector LeftStart, LeftEnd;
227 FVector RightStart, RightEnd;
228 uint8 AreaID;
229 uint8 Direction;
231 };
232#endif // WITH_NAVMESH_SEGMENT_LINKS
233
234 static constexpr int32 BuildTimeBucketsCount = 5;
235
236 TArray<FVector> MeshVerts;
237
242
247
248#if WITH_NAVMESH_CLUSTER_LINKS
251#endif // WITH_NAVMESH_CLUSTER_LINKS
252
253#if WITH_NAVMESH_SEGMENT_LINKS
256#endif // WITH_NAVMESH_SEGMENT_LINKS
257
258#if RECAST_INTERNAL_DEBUG_DATA
260#endif
261
266
267 double MinTileBuildTime = DBL_MAX;
268 double MaxTileBuildTime = 0.;
269
271 {}
272
274};
275
276struct FNavTileRef
277{
278 FNavTileRef() {}
279 explicit FNavTileRef(const uint64 InTileRef) : TileRef(InTileRef) {}
280
281 explicit operator uint64() const { return TileRef; }
282
283 bool operator==(const FNavTileRef InRef) const { return TileRef == (uint64)InRef; }
284 bool operator!=(const FNavTileRef InRef) const { return TileRef != (uint64)InRef; }
285
286 bool IsValid() const { return TileRef != (uint64)FNavTileRef(); }
287
288 inline friend uint32 GetTypeHash(const FNavTileRef& NavTileRef) { return GetTypeHash(NavTileRef.TileRef); }
289
304
305private:
306 uint64 TileRef = 0;
307};
308
309struct FNavPoly
310{
313};
314
315namespace ERecastNamedFilter
316{
317 enum Type
318 {
319 FilterOutNavLinks = 0, // filters out all off-mesh connections
320 FilterOutAreas, // filters out all navigation areas except the default one (RECAST_DEFAULT_AREA)
321 FilterOutNavLinksAndAreas, // combines FilterOutNavLinks and FilterOutAreas
322
324 };
325}
326
328{
329 FNavigationWallEdge() = default;
331 : Start(InStart)
332 , End(InEnd)
333 {
334 }
337};
338#endif //WITH_RECAST
339
340UENUM()
342{
343 Solid = 0,
345};
346
347USTRUCT()
349{
351
353
355 UPROPERTY(Transient, EditAnywhere, Category = Debug)
356 uint32 bEnabled : 1;
357
361 UPROPERTY(EditAnywhere, Category = Debug)
362 FIntVector TileCoordinate = FIntVector::ZeroValue;
363
366 UPROPERTY(EditAnywhere, Category = Debug, meta=(EditCondition="bUseMaxTileCoordinate"))
367 FIntVector MaxTileCoordinate = FIntVector::ZeroValue;
368
370 UPROPERTY(EditAnywhere, Category = Debug)
371 uint32 bGenerateDebugTileOnly : 1;
372
375 UPROPERTY(EditAnywhere, Category = Debug)
376 uint32 bCollisionGeometry : 1;
377
378 UPROPERTY(EditAnywhere, Category = Debug)
379 EHeightFieldRenderMode HeightFieldRenderMode;
380
381 UPROPERTY(EditAnywhere, Category = Debug)
382 uint32 bHeightfieldFromRasterization : 1;
383
384 UPROPERTY(EditAnywhere, Category = Debug)
385 uint32 bHeightfieldPostInclusionBoundsFiltering : 1;
386
387 UPROPERTY(EditAnywhere, Category = Debug)
388 uint32 bHeightfieldPostHeightFiltering : 1;
389
390 UPROPERTY(EditAnywhere, Category = Debug)
391 uint32 bHeightfieldBounds : 1;
392
393 UPROPERTY(EditAnywhere, Category = Debug)
394 uint32 bCompactHeightfield : 1;
395
396 UPROPERTY(EditAnywhere, Category = Debug)
397 uint32 bCompactHeightfieldEroded : 1;
398
399 UPROPERTY(EditAnywhere, Category = Debug)
400 uint32 bHeightFieldLayers : 1;
401
402 UPROPERTY(EditAnywhere, Category = Debug)
403 uint32 bCompactHeightfieldRegions : 1;
404
405 UPROPERTY(EditAnywhere, Category = Debug)
406 uint32 bCompactHeightfieldDistances : 1;
407
408 UPROPERTY(EditAnywhere, Category = Debug)
409 uint32 bTileCacheLayerAreas : 1;
410
411 UPROPERTY(EditAnywhere, Category = Debug)
412 uint32 bTileCacheLayerRegions : 1;
413
415 UPROPERTY(EditAnywhere, Category = Debug)
416 uint32 bSkipContourSimplification : 1;
417
418 UPROPERTY(EditAnywhere, Category = Debug)
419 uint32 bTileCacheContours : 1;
420
421 UPROPERTY(EditAnywhere, Category = Debug)
422 uint32 bTileCachePolyMesh : 1;
423
424 UPROPERTY(EditAnywhere, Category = Debug)
425 uint32 bTileCacheDetailMesh : 1;
426
427 UPROPERTY(EditAnywhere, Category = Debug, meta=(InlineEditConditionToggle))
428 uint32 bUseMaxTileCoordinate : 1;
429
430 UPROPERTY(EditAnywhere, Category = Debug, meta = (Bitmask, BitmaskEnum = "/Script/NavigationSystem.ELinkGenerationDebugFlags"))
431 uint16 LinkGenerationDebugFlags;
432
434 UPROPERTY(EditAnywhere, Category = Debug, meta=(UIMin=-1, ClampMin=-1))
435 int32 LinkGenerationSelectedEdge;
436
438 UPROPERTY(EditAnywhere, Category = Debug, meta=(UIMin=-1, ClampMin=-1))
439 int32 LinkGenerationSelectedConfig;
440
443 NAVIGATIONSYSTEM_API bool IsWithinTileCoordinates(const int32 TileX, const int32 TileY) const;
444};
445
455
460{
461 // helper function so that we release NavData via dtFree not regular delete (for navigation mem stats)
462 struct FNavData
463 {
464 // Temporary test to help reproduce a crash.
465 void TestPtr() const;
466
468 {
469 if (RawNavData != nullptr)
470 {
471 // Temporary test to help reproduce a crash.
472 static uint8 Temp = 0;
473 Temp = *RawNavData;
474
477 }
478 else
479 {
480 AllocatedSize = 0;
481 }
482 }
483 ~FNavData();
484
485 const uint8* GetRawNavData() const { return RawNavData; }
487
488 void Reset()
489 {
490 RawNavData = nullptr;
491 AllocatedSize = 0;
492 }
493
494 protected:
496 SIZE_T AllocatedSize; // != DataSize
497 };
498
499 // layer index
502 // size of allocated data
504 // actual tile data
506
509
511
512 inline uint8* GetData()
513 {
514 check(NavData.IsValid());
515 return NavData->GetMutableRawNavData();
516 }
517
518 inline const uint8* GetData() const
519 {
520 check(NavData.IsValid());
521 return NavData->GetRawNavData();
522 }
523
525 {
526 return NavData.IsValid() ? NavData->GetMutableRawNavData() : NULL;
527 }
528
529 inline bool operator==(const uint8* RawData) const
530 {
531 return GetData() == RawData;
532 }
533
534 inline bool IsValid() const { return NavData.IsValid() && GetData() != nullptr && DataSize > 0; }
535
536 uint8* Release();
537
538 // Duplicate shared state so we will have own copy of the data
539 void MakeUnique();
540};
541
543
551
552USTRUCT()
554{
556
557 bool IsValid() const { return CellSize > 0.f && CellHeight > 0.f && AgentMaxStepHeight > 0.f; }
558
560 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "1.0", ClampMax = "1024.0"))
561 float CellSize = 25.f;
562
564 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "1.0", ClampMax = "1024.0"))
565 float CellHeight = 10.f;
566
568 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "0.0"))
569 float AgentMaxStepHeight = 35.f;
570};
571
572UCLASS(config=Engine, defaultconfig, hidecategories=(Input,Rendering,Tags,Transformation,Actor,Layers,Replication), notplaceable, MinimalAPI)
574{
576
577 typedef uint16 FNavPolyFlags;
578
579 NAVIGATIONSYSTEM_API virtual void Serialize( FArchive& Ar ) override;
580
581#if WITH_EDITOR
582 NAVIGATIONSYSTEM_API virtual bool CanEditChange(const FProperty* InProperty) const override;
583#endif
584
586 UPROPERTY(EditAnywhere, Category=Display)
587 uint32 bDrawTriangleEdges:1;
588
590 UPROPERTY(EditAnywhere, Category=Display, config)
591 uint32 bDrawPolyEdges:1;
592
594 UPROPERTY(EditAnywhere, Category = Display)
595 uint32 bDrawFilledPolys:1;
596
598 UPROPERTY(EditAnywhere, Category=Display)
599 uint32 bDrawNavMeshEdges:1;
600
602 UPROPERTY(EditAnywhere, Category=Display)
603 uint32 bDrawTileBounds:1;
604
606 UPROPERTY(EditAnywhere, Category=Display)
607 uint32 bDrawTileResolutions:1;
608
610 UPROPERTY(EditAnywhere, Category=Display)
611 uint32 bDrawPathCollidingGeometry:1;
612
613 UPROPERTY(EditAnywhere, Category=Display)
614 uint32 bDrawTileLabels:1;
615
616 UPROPERTY(EditAnywhere, Category=Display)
617 uint32 bDrawTileBuildTimes:1;
618
619 UPROPERTY(EditAnywhere, Category=Display)
620 uint32 bDrawTileBuildTimesHeatMap:1;
621
623 UPROPERTY(EditAnywhere, Category=Display, meta = (DisplayName = "Draw Polygon Indices"))
624 uint32 bDrawPolygonLabels:1;
625
627 UPROPERTY(EditAnywhere, Category=Display, meta=(DisplayName="Draw Polygon Costs"))
628 uint32 bDrawDefaultPolygonCost:1;
629
631 UPROPERTY(EditAnywhere, Category=Display)
632 uint32 bDrawPolygonFlags:1;
633
635 UPROPERTY(EditAnywhere, Category=Display)
636 uint32 bDrawPolygonAreaIDs:1;
637
638 UPROPERTY(EditAnywhere, Category=Display)
639 uint32 bDrawLabelsOnPathNodes:1;
640
642 UPROPERTY(EditAnywhere, Category=Display)
643 uint32 bDrawNavLinks:1;
644
646 UPROPERTY(EditAnywhere, Category=Display, Meta = (DisplayName = "Draw Failed and Valid NavLinks"))
647 uint32 bDrawFailedNavLinks:1;
648
650 UPROPERTY(EditAnywhere, Category=Display)
651 uint32 bDrawClusters:1;
652
654 UPROPERTY(EditAnywhere, Category = Display)
655 uint32 bDrawOctree : 1;
656
658 UPROPERTY(EditAnywhere, Category = Display, meta=(editcondition = "bDrawOctree"))
659 uint32 bDrawOctreeDetails : 1;
660
661 UPROPERTY(EditAnywhere, Category = Display)
662 uint32 bDrawMarkedForbiddenPolys : 1;
663
665 UPROPERTY(config)
666 uint32 bDistinctlyDrawTilesBeingBuilt:1;
667
669 UPROPERTY(EditAnywhere, Category=Display, config)
670 float DrawOffset;
671
672 UPROPERTY(EditAnywhere, Category = Display)
673 FRecastNavMeshTileGenerationDebug TileGenerationDebug;
674
675 //----------------------------------------------------------------------//
676 // NavMesh generation parameters
677 //----------------------------------------------------------------------//
678
680 UPROPERTY(EditAnywhere, Category=Generation, config)
681 uint32 bFixedTilePoolSize:1;
682
684 UPROPERTY(EditAnywhere, Category=Generation, config, meta=(editcondition = "bFixedTilePoolSize"))
685 int32 TilePoolSize;
686
688 UPROPERTY(EditAnywhere, Category=Generation, config, meta=(ClampMin = "300.0"))
689 float TileSizeUU;
690
697 UE_DEPRECATED(all, "Use NavMeshResolutionParams to set CellSize for the different resolutions instead")
698 UPROPERTY(config, meta = (DeprecatedProperty, DeprecationMessage = "Use NavMeshResolutionParams to set CellSize for the different resolutions instead"))
699 float CellSize;
700
701 UE_DEPRECATED(all, "Use NavMeshResolutionParams to set CellHeight for the different resolutions instead")
702 UPROPERTY(config, meta = (DeprecatedProperty, DeprecationMessage = "Use NavMeshResolutionParams to set CellHeight for the different resolutions instead"))
703 float CellHeight;
704
705 UE_DEPRECATED(all, "Use NavMeshResolutionParams to set AgentMaxStepHeight for the different resolutions instead")
706 UPROPERTY(config, meta = (DeprecatedProperty, DeprecationMessage = "Use NavMeshResolutionParams to set AgentMaxStepHeight for the different resolutions instead"))
707 float AgentMaxStepHeight;
708
712 UPROPERTY(EditAnywhere, Category = Generation, config)
714
716 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "0.0", ClampMax = "100000.0", UIMin = "0.0", UIMax = "100000.0"))
717 float AgentRadius;
718
720 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "0.0", ClampMax = "100000.0", UIMin = "0.0", UIMax = "100000.0"))
721 float AgentHeight;
722
723 /* The maximum slope (angle) that the agent can move on. */
724 UPROPERTY(EditAnywhere, Category=Generation, config, meta=(ClampMin = "0.0", ClampMax = "89.0", UIMin = "0.0", UIMax = "89.0" ))
725 float AgentMaxSlope;
726
727 /* The minimum dimension of area. Areas smaller than this will be discarded */
728 UPROPERTY(EditAnywhere, Category=Generation, config, meta=(ClampMin = "0.0"))
729 float MinRegionArea;
730
731 /* The size limit of regions to be merged with bigger regions (watershed partitioning only) */
732 UPROPERTY(EditAnywhere, Category=Generation, config, meta=(ClampMin = "0.0"))
733 float MergeRegionSize;
734
738 UE_DEPRECATED(5.5, "Not used anymore, the behavior is now binded to SimplificationElevationRatio.")
739 UPROPERTY(config)
740 int MaxVerticalMergeError;
741
743 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "0.0"))
744 float MaxSimplificationError;
745
748 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "0.0"))
749 float SimplificationElevationRatio;
750
752 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "0", UIMin = "0"), AdvancedDisplay)
753 int32 MaxSimultaneousTileGenerationJobsCount;
754
759 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "1", UIMin = "1"), AdvancedDisplay)
760 int32 TileNumberHardLimit;
761
763 UPROPERTY(EditAnywhere, Category = Generation, config, meta = (ClampMin = "1", UIMin = "1"), AdvancedDisplay)
764 int32 ExpectedMaxLayersPerTile;
765
766 UPROPERTY(VisibleAnywhere, Category = Generation, AdvancedDisplay)
767 int32 PolyRefTileBits;
768
769 UPROPERTY(VisibleAnywhere, Category = Generation, AdvancedDisplay)
770 int32 PolyRefNavPolyBits;
771
772 UPROPERTY(VisibleAnywhere, Category = Generation, AdvancedDisplay)
773 int32 PolyRefSaltBits;
774
776 UPROPERTY(EditAnywhere, Category = Generation, AdvancedDisplay)
777 FVector NavMeshOriginOffset;
778
780 UPROPERTY(config)
781 float DefaultDrawDistance;
782
785 UPROPERTY(config)
786 float DefaultMaxSearchNodes;
787
789 UPROPERTY(config)
790 float DefaultMaxHierarchicalSearchNodes;
791
793 UPROPERTY(EditAnywhere, Category=Generation, config, AdvancedDisplay)
794 ENavigationLedgeSlopeFilterMode LedgeSlopeFilterMode;
795
797 UPROPERTY(EditAnywhere, Category=Generation, config, AdvancedDisplay)
799
801 UPROPERTY(EditAnywhere, Category=Generation, config, AdvancedDisplay)
803
805 UPROPERTY(EditAnywhere, Category=Generation, config, AdvancedDisplay)
806 int32 RegionChunkSplits;
807
809 UPROPERTY(EditAnywhere, Category=Generation, config, AdvancedDisplay)
810 int32 LayerChunkSplits;
811
817 UPROPERTY(EditAnywhere, Category=Generation, config)
818 uint32 bSortNavigationAreasByCost:1;
819
820 /* In a world partitioned map, is this navmesh using world partitioning */
821 UPROPERTY(EditAnywhere, Category=Generation, config, meta = (EditCondition = "bAllowWorldPartitionedNavMesh", HideEditConditionToggle, DisplayName = "IsWorldPartitionedNavMesh"))
822 uint32 bIsWorldPartitioned : 1;
823
826 UPROPERTY(EditAnywhere, Category=Generation, config)
827 uint32 bGenerateNavLinks : 1;
828
831 UPROPERTY(EditAnywhere, Category=Generation, config, AdvancedDisplay)
832 uint32 bPerformVoxelFiltering:1;
833
835 UPROPERTY(EditAnywhere, Category = Generation, config, AdvancedDisplay)
836 uint32 bMarkLowHeightAreas : 1;
837
840 UPROPERTY(EditAnywhere, Category = Generation, config, AdvancedDisplay)
841 uint32 bUseExtraTopCellWhenMarkingAreas : 1;
842
844 UPROPERTY(EditAnywhere, Category = Generation, config, AdvancedDisplay)
845 uint32 bFilterLowSpanSequences : 1;
846
848 UPROPERTY(EditAnywhere, Category = Generation, config, AdvancedDisplay)
849 uint32 bFilterLowSpanFromTileCache : 1;
850
852 UPROPERTY(EditAnywhere, Category = Generation, config, AdvancedDisplay)
853 uint32 bDoFullyAsyncNavDataGathering : 1;
854
856 UPROPERTY(config)
857 uint32 bUseBetterOffsetsFromCorners : 1;
858
860 UPROPERTY(config)
861 uint32 bStoreEmptyTileLayers : 1;
862
864 UPROPERTY(config)
865 uint32 bUseVirtualFilters : 1;
866
871 UPROPERTY(config)
872 uint32 bUseVirtualGeometryFilteringAndDirtying : 1;
873
875 UPROPERTY(config)
876 uint32 bAllowNavLinkAsPathEnd : 1;
877
879 UPROPERTY(EditAnywhere, Category = TimeSlicing, config, AdvancedDisplay, meta = (ClampMin = "1", UIMin = "1"))
880 int32 TimeSliceFilterLedgeSpansMaxYProcess = 13;
881
883 UPROPERTY(EditAnywhere, Category = TimeSlicing, config, AdvancedDisplay)
884 double TimeSliceLongDurationDebug = 0.002;
885
887 UPROPERTY(EditAnywhere, Category = Generation, config, AdvancedDisplay)
888 uint32 InvokerTilePriorityBumpDistanceThresholdInTileUnits = 1;
889
891 UPROPERTY(EditAnywhere, Category = Generation, config, AdvancedDisplay)
892 uint8 InvokerTilePriorityBumpIncrease = 1;
893
894protected:
895#if WITH_EDITORONLY_DATA
897 UPROPERTY()
899#endif // WITH_EDITORONLY_DATA
900
901#if WITH_EDITORONLY_DATA
904 UE_DEPRECATED(5.7, "Use the NavLinkJumpConfigs array instead.")
905 UPROPERTY(config)
908#endif // WITH_EDITORONLY_DATA
909
911 UPROPERTY(EditAnywhere, Category=Generation, config)
913
914private:
916 bool bHasNoTileData : 1 = false;
917
919 UPROPERTY(config)
920 uint32 bUseVoxelCache : 1;
921
923 UPROPERTY(config)
924 float TileSetUpdateInterval;
925
927 static NAVIGATIONSYSTEM_API FNavPolyFlags NavLinkFlag;
928
930 static NAVIGATIONSYSTEM_API FVector::FReal DrawDistanceSq;
931
933 static NAVIGATIONSYSTEM_API float MinimumSizeForChaosNavMeshInfluenceSq;
934
935public:
936
938 {
939 enum
940 {
941 MAX_PATH_CORRIDOR_POLYS = 128
942 };
943
944 NavNodeRef CorridorPolys[MAX_PATH_CORRIDOR_POLYS];
945 float CorridorCost[MAX_PATH_CORRIDOR_POLYS];
950
952 : CorridorPolysCount(0)
953 , HitTime(TNumericLimits<FVector::FReal>::Max())
954 , HitNormal(0.f)
955 , bIsRaycastEndInCorridor(false)
956 {
957 FMemory::Memzero(CorridorPolys);
958 FMemory::Memzero(CorridorCost);
959 }
960
961 inline int32 GetMaxCorridorSize() const { return MAX_PATH_CORRIDOR_POLYS; }
962 inline bool HasHit() const { return HitTime != TNumericLimits<FVector::FReal>::Max(); }
963 inline NavNodeRef GetLastNodeRef() const { return CorridorPolysCount > 0 ? CorridorPolys[CorridorPolysCount - 1] : INVALID_NAVNODEREF; }
964 };
965
966 //----------------------------------------------------------------------//
967 // Recast runtime params
968 //----------------------------------------------------------------------//
970 UPROPERTY(EditAnywhere, Category = Query, config, meta = (ClampMin = "0.1"))
971 float HeuristicScale;
972
974 UPROPERTY(EditAnywhere, Category = Query, config, meta = (ClampMin = "0.0"))
975 float VerticalDeviationFromGroundCompensation;
976
978 FOnNavMeshUpdate OnNavMeshUpdate;
979
980 inline static void SetDrawDistance(FVector::FReal NewDistance) { DrawDistanceSq = NewDistance * NewDistance; }
981 inline static FVector::FReal GetDrawDistanceSq() { return DrawDistanceSq; }
982
983 inline static void SetMinimumSizeForChaosNavMeshInfluence(float NewSize) { MinimumSizeForChaosNavMeshInfluenceSq = NewSize * NewSize; }
984 inline static float GetMinimumSizeForChaosNavMeshInfluenceSq() { return MinimumSizeForChaosNavMeshInfluenceSq; }
985
986
988
989 NAVIGATIONSYSTEM_API bool HasValidNavmesh() const;
990
993
994#if WITH_RECAST
995 //----------------------------------------------------------------------//
996 // Life cycle & serialization
997 //----------------------------------------------------------------------//
998public:
999
1000 //~ Begin UObject Interface
1001 NAVIGATIONSYSTEM_API virtual void PostInitProperties() override;
1002 NAVIGATIONSYSTEM_API virtual void PostLoad() override;
1003 NAVIGATIONSYSTEM_API virtual void PostRegisterAllComponents() override;
1004 NAVIGATIONSYSTEM_API virtual void PostUnregisterAllComponents() override;
1005 NAVIGATIONSYSTEM_API virtual void BeginDestroy() override;
1006
1007#if WITH_EDITOR
1009 NAVIGATIONSYSTEM_API virtual void PostEditChangeProperty( struct FPropertyChangedEvent& PropertyChangedEvent) override;
1010 NAVIGATIONSYSTEM_API virtual void PostEditUndo() override;
1011#endif // WITH_EDITOR
1012 //~ End UObject Interface
1013
1014#if WITH_EDITOR
1016 virtual bool ShouldExport() override { return false; }
1017#endif
1018
1019 NAVIGATIONSYSTEM_API virtual void LoadBeforeGeneratorRebuild() override;
1020
1021 NAVIGATIONSYSTEM_API virtual void CleanUp() override;
1022
1023 //~ Begin ANavigationData Interface
1024 NAVIGATIONSYSTEM_API virtual FNavLocation GetRandomPoint(FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1027 NAVIGATIONSYSTEM_API virtual bool GetRandomReachablePointInRadius(const FVector& Origin, float Radius, FNavLocation& OutResult, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1028 NAVIGATIONSYSTEM_API virtual bool GetRandomPointInNavigableRadius(const FVector& Origin, float Radius, FNavLocation& OutResult, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1029
1030 NAVIGATIONSYSTEM_API virtual bool FindMoveAlongSurface(const FNavLocation& StartLocation, const FVector& TargetPosition, FNavLocation& OutLocation, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1031 NAVIGATIONSYSTEM_API virtual bool FindOverlappingEdges(const FNavLocation& StartLocation, TConstArrayView<FVector> ConvexPolygon, TArray<FVector>& OutEdges, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1032 NAVIGATIONSYSTEM_API virtual bool GetPathSegmentBoundaryEdges(const FNavigationPath& Path, const FNavPathPoint& StartPoint, const FNavPathPoint& EndPoint, const TConstArrayView<FVector> SearchArea, TArray<FVector>& OutEdges, const float MaxAreaEnterCost, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1033 NAVIGATIONSYSTEM_API virtual bool ProjectPoint(const FVector& Point, FNavLocation& OutLocation, const FVector& Extent, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1034 NAVIGATIONSYSTEM_API virtual bool IsNodeRefValid(NavNodeRef NodeRef) const override;
1035
1037 NAVIGATIONSYSTEM_API virtual void BatchProjectPoints(TArray<FNavigationProjectionWork>& Workload, const FVector& Extent, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1038
1042 NAVIGATIONSYSTEM_API virtual void BatchProjectPoints(TArray<FNavigationProjectionWork>& Workload, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const override;
1043
1047 NAVIGATIONSYSTEM_API virtual bool DoesNodeContainLocation(NavNodeRef NodeRef, const FVector& WorldSpaceLocation) const override;
1048
1049 NAVIGATIONSYSTEM_API virtual UPrimitiveComponent* ConstructRenderingComponent() override;
1051 virtual FBox GetBounds() const override { return GetNavMeshBounds(); }
1053 NAVIGATIONSYSTEM_API virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift) override;
1054
1055 NAVIGATIONSYSTEM_API virtual void FillNavigationDataChunkActor(const FBox& InQueryBounds, class ANavigationDataChunkActor& DataChunkActor, FBox& OutTilesBounds) const override;
1056
1057 NAVIGATIONSYSTEM_API virtual void OnStreamingNavDataAdded(class ANavigationDataChunkActor& InActor) override;
1058 NAVIGATIONSYSTEM_API virtual void OnStreamingNavDataRemoved(class ANavigationDataChunkActor& InActor) override;
1059
1060 NAVIGATIONSYSTEM_API virtual void OnStreamingLevelAdded(ULevel* InLevel, UWorld* InWorld) override;
1061 NAVIGATIONSYSTEM_API virtual void OnStreamingLevelRemoved(ULevel* InLevel, UWorld* InWorld) override;
1062
1063#if WITH_EDITOR
1064 NAVIGATIONSYSTEM_API virtual double GetWorldPartitionNavigationDataBuilderOverlap() const override;
1065#endif
1066 //~ End ANavigationData Interface
1067
1070
1073
1074 NAVIGATIONSYSTEM_API void LogRecastTile(const TCHAR* Caller, const FName& Prefix, const FName& OperationName, const dtNavMesh& DetourMesh, const int32 TileX, const int32 TileY, const int32 LayerIndex, const uint64 TileRef) const;
1075
1076protected:
1079
1080 NAVIGATIONSYSTEM_API virtual void RestrictBuildingToActiveTiles(bool InRestrictBuildingToActiveTiles) override;
1081
1082 NAVIGATIONSYSTEM_API virtual void OnRegistered() override;
1083
1084public:
1086 float GetCellSize(const ENavigationDataResolution Resolution) const { return NavMeshResolutionParams[(uint8)Resolution].CellSize; }
1087
1089 void SetCellSize(const ENavigationDataResolution Resolution, const float Size) { NavMeshResolutionParams[(uint8)Resolution].CellSize = Size; }
1090
1092 float GetCellHeight(const ENavigationDataResolution Resolution) const { return NavMeshResolutionParams[(uint8)Resolution].CellHeight; }
1093
1095 void SetCellHeight(const ENavigationDataResolution Resolution, const float Height) { NavMeshResolutionParams[(uint8)Resolution].CellHeight = Height; }
1096
1098 float GetAgentMaxStepHeight(const ENavigationDataResolution Resolution) const { return NavMeshResolutionParams[(uint8)Resolution].AgentMaxStepHeight; }
1099
1101 void SetAgentMaxStepHeight(const ENavigationDataResolution Resolution, const float MaxStepHeight) { NavMeshResolutionParams[(uint8)Resolution].AgentMaxStepHeight = MaxStepHeight; }
1102
1104 NAVIGATIONSYSTEM_API float GetTileSizeUU() const;
1105
1107 NAVIGATIONSYSTEM_API bool IsResizable() const;
1108
1111
1113 UE_DEPRECATED(5.5, "Use the version of this function that takes a FNavTileRef instead.")
1115
1118
1120 UE_DEPRECATED(5.5, "Use the version of this function that takes a FNavTileRef instead.")
1121 NAVIGATIONSYSTEM_API bool GetNavMeshTileXY(int32 TileIndex, int32& OutX, int32& OutY, int32& Layer) const;
1122
1125
1128
1130 UE_DEPRECATED(5.5, "Use the version of this function that takes a FNavTileRef instead.")
1132
1135
1138
1140 UE_DEPRECATED(5.5, "Use the version of this function that takes an array of FNavTileRefs instead.")
1141 NAVIGATIONSYSTEM_API void GetNavMeshTilesAt(int32 TileX, int32 TileY, TArray<int32>& Indices) const;
1142
1145
1148
1151
1154
1157
1158#if RECAST_INTERNAL_DEBUG_DATA
1161#endif
1162
1165
1168
1170#if !UE_BUILD_SHIPPING
1172#endif
1173
1175
1176 NAVIGATIONSYSTEM_API void UpdateDrawing();
1177
1180
1183
1184#if WITH_NAVMESH_SEGMENT_LINKS
1187#endif
1188
1191
1192 NAVIGATIONSYSTEM_API virtual void EnsureBuildCompletion() override;
1193
1194 NAVIGATIONSYSTEM_API virtual void SetConfig(const FNavDataConfig& Src) override;
1195protected:
1196 NAVIGATIONSYSTEM_API virtual void FillConfig(FNavDataConfig& Dest) override;
1197
1199 {
1200 return *(Filter.IsValid() ? Filter.Get() : GetDefaultQueryFilter().Get());
1201 }
1202
1203public:
1204
1206
1207 //----------------------------------------------------------------------//
1208 // Debug
1209 //----------------------------------------------------------------------//
1210
1211 /* Gather debug geometry.
1212 * @params OutGeometry Output geometry.
1213 * @params TileIndex Used to collect geometry for a specific tile, INDEX_NONE will gather all tiles
1214 * @return True if done collecting.
1215 */
1216 UE_DEPRECATED(5.5, "Use the version of the function that takes a FNavTileRef instead.")
1218
1219 /* Gather debug geometry.
1220 * @params OutGeometry Output geometry.
1221 * @params TileRef Used to collect geometry for a specific tile, an invalid FNavTileRef will gather all tiles
1222 * @return True if done collecting.
1223 */
1225
1226 // @todo docuement
1228
1229#if !UE_BUILD_SHIPPING
1230 NAVIGATIONSYSTEM_API virtual uint32 LogMemUsed() const override;
1231#endif // !UE_BUILD_SHIPPING
1232
1234
1235 //----------------------------------------------------------------------//
1236 // Utilities
1237 //----------------------------------------------------------------------//
1238 NAVIGATIONSYSTEM_API virtual void OnNavAreaChanged() override;
1239 NAVIGATIONSYSTEM_API virtual void OnNavAreaAdded(const UClass* NavAreaClass, int32 AgentIndex) override;
1240 NAVIGATIONSYSTEM_API virtual void OnNavAreaRemoved(const UClass* NavAreaClass) override;
1241 NAVIGATIONSYSTEM_API virtual int32 GetNewAreaID(const UClass* AreaClass) const override;
1242 virtual int32 GetMaxSupportedAreas() const override { return RECAST_MAX_AREAS; }
1243
1248
1251
1253
1254 int32 GetMaxSimultaneousTileGenerationJobsCount() const { return MaxSimultaneousTileGenerationJobsCount; }
1255 NAVIGATIONSYSTEM_API void SetMaxSimultaneousTileGenerationJobsCount(int32 NewJobsCountLimit);
1256
1259 {
1260 // Using HALF_WORLD_MAX instead of BIG_NUMBER, else using the extent for a box will result in NaN.
1261 return FVector(QueryExtent.X, QueryExtent.Y, QueryExtent.Z >= HALF_WORLD_MAX ? HALF_WORLD_MAX : (QueryExtent.Z + FMath::Max(0., VerticalDeviationFromGroundCompensation)));
1262 }
1263
1264 //----------------------------------------------------------------------//
1265 // Custom navigation links
1266 //----------------------------------------------------------------------//
1267
1268 NAVIGATIONSYSTEM_API virtual void UpdateCustomLink(const INavLinkCustomInterface* CustomLink) override;
1269
1270 UE_DEPRECATED(5.3, "Use version of this function that takes a FNavLinkId. This function now has no effect.")
1271 void UpdateNavigationLinkArea(int32 UserId, TSubclassOf<UNavArea> AreaClass) const {}
1272
1275
1276#if WITH_NAVMESH_SEGMENT_LINKS
1279#endif // WITH_NAVMESH_SEGMENT_LINKS
1280
1281 //----------------------------------------------------------------------//
1282 // Batch processing (important with async rebuilding)
1283 //----------------------------------------------------------------------//
1284
1286 NAVIGATIONSYSTEM_API virtual void BeginBatchQuery() const override;
1287
1289 NAVIGATIONSYSTEM_API virtual void FinishBatchQuery() const override;
1290
1291 //----------------------------------------------------------------------//
1292 // Querying
1293 //----------------------------------------------------------------------//
1294
1297
1300
1301 UE_DEPRECATED(5.3, "Please use GetNavLinkUserId() instead. This function only returns Invalid.")
1303 {
1304 return static_cast<int32>(FNavLinkId::Invalid.GetId());
1305 }
1306
1309
1311
1314
1317
1321
1324
1327
1330
1333
1336
1339
1342
1346
1348 NAVIGATIONSYSTEM_API bool GetPolyFlags(NavNodeRef PolyID, uint16& PolyFlags, uint16& AreaFlags) const;
1350
1353
1356
1359
1362
1365
1368
1371
1374
1377
1380
1386 FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr, FRecastDebugPathfindingData* DebugData = nullptr) const;
1387
1390
1392 UE_DEPRECATED(5.5, "Use the version of this function that takes a FNavTileRef instead.")
1393 NAVIGATIONSYSTEM_API bool GetPolysInTile(int32 TileIndex, TArray<FNavPoly>& Polys) const;
1394
1397
1399 NAVIGATIONSYSTEM_API bool GetPolysInBox(const FBox& Box, TArray<FNavPoly>& Polys, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Owner = nullptr) const;
1400
1403
1406
1409
1411 NAVIGATIONSYSTEM_API bool GetNavLinksInTile(const int32 TileIndex, TArray<FNavPoly>& Polys, const bool bIncludeLinksFromNeighborTiles) const;
1412
1415 FVector::FReal MinZ, FVector::FReal MaxZ, FSharedConstNavQueryFilter Filter = NULL, const UObject* Querier = NULL) const;
1416
1417 // @todo document
1421 static NAVIGATIONSYSTEM_API bool NavMeshRaycast(const ANavigationData* Self, const FVector& RayStart, const FVector& RayEnd, FVector& HitLocation, FSharedConstNavQueryFilter QueryFilter, const UObject* Querier, FRaycastResult& Result);
1422 static bool NavMeshRaycast(const ANavigationData* Self, const FVector& RayStart, const FVector& RayEnd, FVector& HitLocation, FSharedConstNavQueryFilter QueryFilter, const UObject* Querier = NULL);
1424 static NAVIGATIONSYSTEM_API bool NavMeshRaycast(const ANavigationData* Self, NavNodeRef RayStartNode, const FVector& RayStart, const FVector& RayEnd, FVector& HitLocation, FSharedConstNavQueryFilter QueryFilter, const UObject* Querier = NULL);
1426
1427 NAVIGATIONSYSTEM_API virtual void BatchRaycast(TArray<FNavigationRaycastWork>& Workload, FSharedConstNavQueryFilter QueryFilter, const UObject* Querier = NULL) const override;
1428
1432
1437
1441 NAVIGATIONSYSTEM_API bool HasCompleteDataAroundSegment(const FVector& StartLocation, const FVector& EndLocation, FVector::FReal TestRadius) const;
1442
1445
1448
1450 NAVIGATIONSYSTEM_API bool FindStraightPath(const FVector& StartLoc, const FVector& EndLoc, const TArray<NavNodeRef>& PathCorridor, TArray<FNavPathPoint>& PathPoints, TArray<FNavLinkId>* CustomLinks = NULL) const;
1451
1454
1456 inline static FNavPolyFlags GetNavLinkFlag() { return NavLinkFlag; }
1457
1458 NAVIGATIONSYSTEM_API virtual bool NeedsRebuild() const override;
1459 NAVIGATIONSYSTEM_API virtual bool SupportsRuntimeGeneration() const override;
1460 NAVIGATIONSYSTEM_API virtual bool SupportsStreaming() const override;
1461
1463
1467
1469 NAVIGATIONSYSTEM_API virtual void PostLoadPreRebuild() override;
1470
1471 NAVIGATIONSYSTEM_API virtual void ConditionalConstructGenerator() override;
1472
1473 bool ShouldGatherDataOnGameThread() const { return bDoFullyAsyncNavDataGathering == false; }
1474 int32 GetTileNumberHardLimit() const { return TileNumberHardLimit; }
1475
1476 NAVIGATIONSYSTEM_API virtual void UpdateActiveTiles(const TArray<FNavigationInvokerRaw>& InvokerLocations);
1477 NAVIGATIONSYSTEM_API virtual void RemoveTiles(const TArray<FIntPoint>& Tiles);
1478
1480
1481 NAVIGATIONSYSTEM_API void DirtyTilesInBounds(const FBox& Bounds);
1482
1483#if RECAST_INTERNAL_DEBUG_DATA
1485#endif
1486
1487#if WITH_EDITORONLY_DATA
1489 UE_DEPRECATED(5.7, "Use GetNavLinkJumpConfigs instead.")
1492#endif // WITH_EDITORONLY_DATA
1493
1494 const TArray<FNavLinkGenerationJumpConfig>& GetNavLinkJumpConfigs() const { return NavLinkJumpConfigs; }
1495
1496protected:
1497
1499
1502
1506
1508
1511
1512 /* Create and register links proxy. It's expected to be called on load or when the navmesh is rebuilt. */
1513 UE_DEPRECATED(5.7, "Use the override using an FNavLinkGenerationJumpConfig instead.")
1514 void CreateAndRegisterJumpDownLinksProxy(const FNavLinkId LinkProxyId = FNavLinkId::GenerateUniqueId());
1515
1516 /* Create and register links proxy. It's expected to be called on load or when the navmesh is rebuilt. */
1518
1519private:
1524 // destroys FPImplRecastNavMesh instance if it has been created
1526 // @todo docuement
1529
1532
1535
1537 bool HasCompleteDataInTile(const int32 TileX, const int32 TileY) const;
1538
1539protected:
1540 // retrieves RecastNavMeshImpl
1543
1545 {
1547
1548#if WITH_EDITORONLY_DATA
1549 UE_DEPRECATED(5.5, "TilesInMinDistance not used anymore, use TilesInMinDistanceMap instead.")
1551#endif
1553
1556 };
1558
1559private:
1562
1565
1573
1574#if RECAST_ASYNC_REBUILDING
1576 mutable int32 BatchQueryCounter;
1577
1578#endif // RECAST_ASYNC_REBUILDING
1579
1580private:
1581 static NAVIGATIONSYSTEM_API const FRecastQueryFilter* NamedFilters[ERecastNamedFilter::NamedFiltersCount];
1582#else
1583 virtual bool IsNodeRefValid(NavNodeRef NodeRef) const override { return true; }
1584 virtual FBox GetBounds() const override { return FBox(); }
1585 virtual void BatchRaycast(TArray<FNavigationRaycastWork>& Workload, FSharedConstNavQueryFilter QueryFilter, const UObject* Querier = nullptr) const override {}
1586 virtual bool FindMoveAlongSurface(const FNavLocation& StartLocation, const FVector& TargetPosition, FNavLocation& OutLocation, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override { return false; }
1587 virtual bool FindOverlappingEdges(const FNavLocation& StartLocation, TConstArrayView<FVector> ConvexPolygon, TArray<FVector>& OutEdges, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override { return false; }
1588 virtual bool GetPathSegmentBoundaryEdges(const FNavigationPath& Path, const FNavPathPoint& StartPoint, const FNavPathPoint& EndPoint, const TConstArrayView<FVector> SearchArea, TArray<FVector>& OutEdges, const float MaxAreaEnterCost, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override { return false; }
1589 virtual FNavLocation GetRandomPoint(FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override { return FNavLocation(); }
1590 virtual bool GetRandomReachablePointInRadius(const FVector& Origin, float Radius, FNavLocation& OutResult, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override { return false; }
1591 virtual bool GetRandomPointInNavigableRadius(const FVector& Origin, float Radius, FNavLocation& OutResult, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override { return false; }
1592 virtual bool ProjectPoint(const FVector& Point, FNavLocation& OutLocation, const FVector& Extent, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override { return false; }
1593 virtual void BatchProjectPoints(TArray<FNavigationProjectionWork>& Workload, const FVector& Extent, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override {}
1594 virtual void BatchProjectPoints(TArray<FNavigationProjectionWork>& Workload, FSharedConstNavQueryFilter Filter = nullptr, const UObject* Querier = nullptr) const override {}
1598 virtual bool DoesNodeContainLocation(NavNodeRef NodeRef, const FVector& WorldSpaceLocation) const override { return false; }
1599#endif // WITH_RECAST
1600
1601public:
1602 //----------------------------------------------------------------------//
1603 // Blueprint functions
1604 //----------------------------------------------------------------------//
1605
1607 UFUNCTION(BlueprintCallable, Category = NavMesh, meta = (DisplayName = "ReplaceAreaInTileBounds"))
1608 NAVIGATIONSYSTEM_API bool K2_ReplaceAreaInTileBounds(FBox Bounds, TSubclassOf<UNavArea> OldArea, TSubclassOf<UNavArea> NewArea, bool ReplaceLinks = true);
1609};
1610
1611#if WITH_RECAST
1612inline
1613bool ARecastNavMesh::NavMeshRaycast(const ANavigationData* Self, const FVector& RayStart, const FVector& RayEnd, FVector& HitLocation, FSharedConstNavQueryFilter QueryFilter, const UObject* Querier)
1614{
1615 return NavMeshRaycast(Self, RayStart, RayEnd, HitLocation, nullptr, QueryFilter, Querier);
1616}
1617
1618inline
1619bool ARecastNavMesh::NavMeshRaycast(const ANavigationData* Self, const FVector& RayStart, const FVector& RayEnd, FVector& HitLocation, FNavigationRaycastAdditionalResults* AdditionalResults, FSharedConstNavQueryFilter QueryFilter, const UObject* Querier)
1620{
1621 FRaycastResult Result;
1622 const bool bDidHit = NavMeshRaycast(Self, RayStart, RayEnd, HitLocation, QueryFilter, Querier, Result);
1624 {
1625 AdditionalResults->bIsRayEndInCorridor = Result.bIsRaycastEndInCorridor;
1626 }
1627 return bDidHit;
1628}
1629
1630
1634{
1635 ARecastNavMesh::FNavPolyFlags FlagsPerArea[RECAST_MAX_AREAS];
1636 ARecastNavMesh::FNavPolyFlags FlagsPerOffMeshLinkArea[RECAST_MAX_AREAS];
1637 TMap<const UClass*, int32> AreaClassToIdMap;
1640
1641 static FRecastNavMeshCachedData Construct(const ARecastNavMesh* RecastNavMeshActor);
1642 void OnAreaAdded(const UClass* AreaClass, int32 AreaID);
1643 void OnAreaRemoved(const UClass* AreaClass);
1644};
1645
1646#endif // WITH_RECAST
OODEFFUNC typedef const int const char * function
Definition oodle2.h:710
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define NULL
Definition oodle2base.h:134
#define check(expr)
Definition AssertionMacros.h:314
return Self
Definition CocoaThread.cpp:337
@ ForceInit
Definition CoreMiscDefines.h:155
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:23
DIRECTLINK_API Display
Definition DirectLinkLog.h:8
#define HALF_WORLD_MAX
Definition EngineDefines.h:56
return true
Definition ExternalRpcRegistry.cpp:601
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#define FVector
Definition IOSSystemIncludes.h:8
ELinkGenerationDebugFlags
Definition LinkGenerationDebugFlags.h:8
UE_FORCEINLINE_HINT bool operator!=(const FIndexedPointer &Other) const
Definition LockFreeList.h:76
UE::Math::TBox< double > FBox
Definition MathFwd.h:55
ENavigationDataResolution
Definition NavigationDataResolution.h:9
ENavigationInvokerPriority
Definition NavigationInvokerPriority.h:9
uint64 NavNodeRef
Definition NavigationTypes.h:34
#define INVALID_NAVNODEREF
Definition NavigationTypes.h:35
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define RECAST_MAX_AREAS
Definition RecastNavMesh.h:23
EHeightFieldRenderMode
Definition RecastNavMesh.h:342
ENavigationLedgeSlopeFilterMode
Definition RecastNavMesh.h:81
void Construct(const FArguments &InArgs)
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
uint32 Size
Definition VulkanMemory.cpp:4034
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition NavigationDataChunkActor.h:14
Definition NavigationData.h:547
Definition RecastNavMesh.h:574
virtual ENavigationQueryResult::Type CalcPathLength(const FVector &PathStart, const FVector &PathEnd, FVector::FReal &OutPathLength, FSharedConstNavQueryFilter QueryFilter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1596
static void SetMinimumSizeForChaosNavMeshInfluence(float NewSize)
Definition RecastNavMesh.h:983
virtual bool FindMoveAlongSurface(const FNavLocation &StartLocation, const FVector &TargetPosition, FNavLocation &OutLocation, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1586
virtual bool FindOverlappingEdges(const FNavLocation &StartLocation, TConstArrayView< FVector > ConvexPolygon, TArray< FVector > &OutEdges, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1587
virtual bool GetPathSegmentBoundaryEdges(const FNavigationPath &Path, const FNavPathPoint &StartPoint, const FNavPathPoint &EndPoint, const TConstArrayView< FVector > SearchArea, TArray< FVector > &OutEdges, const float MaxAreaEnterCost, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1588
virtual void BatchRaycast(TArray< FNavigationRaycastWork > &Workload, FSharedConstNavQueryFilter QueryFilter, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1585
static FVector::FReal GetDrawDistanceSq()
Definition RecastNavMesh.h:981
virtual void BatchProjectPoints(TArray< FNavigationProjectionWork > &Workload, const FVector &Extent, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1593
virtual FBox GetBounds() const override
Definition RecastNavMesh.h:1584
virtual ENavigationQueryResult::Type CalcPathCost(const FVector &PathStart, const FVector &PathEnd, FVector::FReal &OutPathCost, FSharedConstNavQueryFilter QueryFilter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1595
static float GetMinimumSizeForChaosNavMeshInfluenceSq()
Definition RecastNavMesh.h:984
virtual bool IsNodeRefValid(NavNodeRef NodeRef) const override
Definition RecastNavMesh.h:1583
virtual bool DoesNodeContainLocation(NavNodeRef NodeRef, const FVector &WorldSpaceLocation) const override
Definition RecastNavMesh.h:1598
virtual FNavLocation GetRandomPoint(FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1589
virtual ENavigationQueryResult::Type CalcPathLengthAndCost(const FVector &PathStart, const FVector &PathEnd, FVector::FReal &OutPathLength, FVector::FReal &OutPathCost, FSharedConstNavQueryFilter QueryFilter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1597
virtual bool ProjectPoint(const FVector &Point, FNavLocation &OutLocation, const FVector &Extent, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1592
virtual bool GetRandomPointInNavigableRadius(const FVector &Origin, float Radius, FNavLocation &OutResult, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1591
virtual void BatchProjectPoints(TArray< FNavigationProjectionWork > &Workload, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1594
virtual bool GetRandomReachablePointInRadius(const FVector &Origin, float Radius, FNavLocation &OutResult, FSharedConstNavQueryFilter Filter=nullptr, const UObject *Querier=nullptr) const override
Definition RecastNavMesh.h:1590
Definition Engine.Build.cs:7
Definition Archive.h:1208
Definition NameTypes.h:617
Definition UnrealType.h:3087
Definition UnrealType.h:174
Definition SetUtilities.h:95
Definition NavLinkCustomInterface.h:40
Definition Array.h:670
Definition EnumAsByte.h:22
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
Definition SubclassOf.h:30
Definition Canvas.h:159
Definition Class.h:3793
Definition Level.h:423
Definition NavArea.h:18
Definition NavigationDataChunk.h:17
Definition NavigationSystemBase.h:245
Definition NavigationSystem.h:296
Definition Object.h:95
Definition RecastNavMeshDataChunk.h:66
Definition World.h:918
Definition DetourNavMesh.h:503
Definition DetourNavMeshQuery.h:96
@ Basic
Definition BehaviorTreeTypes.h:218
@ PathLength
Definition EnvQueryTest_Pathfinding.h:28
@ TotalCost
Definition NavigationTestingActor.h:39
Type
Definition NavigationTypes.h:629
@ Invalid
Definition NavigationTypes.h:630
Type
Definition PawnAction_Move.h:11
Definition RecastNavMesh.h:68
Type
Definition RecastNavMesh.h:72
@ Watershed
Definition RecastNavMesh.h:74
@ ChunkyMonotone
Definition RecastNavMesh.h:75
@ Monotone
Definition RecastNavMesh.h:73
Definition RecastNavMesh.h:127
const int32 SkipStringPulling
Definition RecastNavMesh.h:129
const int32 GenerateCorridor
Definition RecastNavMesh.h:132
const uint8 FirstAvailableFlag
Definition RecastNavMesh.h:135
uint32 GetTypeHash(const FKey &Key)
Definition BlackboardKey.h:35
Definition RecastNavMesh.h:545
SIZE_T GetAllocatedSize(const T &Value)
Definition ManagedArray.h:93
double GetCellSize(int32 Level)
Definition RenderingSpatialHash.h:96
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501
@ Start
Definition GeoEnum.h:100
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
@ Ref
Value is copied out after function call. Only valid on function param declaration.
Definition ObjectMacros.h:1074
@ false
Definition radaudio_common.h:23
Definition RecastNavMesh.h:938
uint32 bIsRaycastEndInCorridor
Definition RecastNavMesh.h:949
bool HasHit() const
Definition RecastNavMesh.h:962
FVector::FReal HitTime
Definition RecastNavMesh.h:947
FRaycastResult()
Definition RecastNavMesh.h:951
NavNodeRef GetLastNodeRef() const
Definition RecastNavMesh.h:963
int32 CorridorPolysCount
Definition RecastNavMesh.h:946
int32 GetMaxCorridorSize() const
Definition RecastNavMesh.h:961
FVector HitNormal
Definition RecastNavMesh.h:948
Definition Color.h:486
Definition RecastNavMesh.h:103
int32 DetailVertsSize
Definition RecastNavMesh.h:116
int32 PolysSize
Definition RecastNavMesh.h:113
int32 LinksSize
Definition RecastNavMesh.h:114
int32 HeaderSize
Definition RecastNavMesh.h:111
int32 BvTreeSize
Definition RecastNavMesh.h:118
int32 DetailMeshesSize
Definition RecastNavMesh.h:115
int32 OffMeshConsSize
Definition RecastNavMesh.h:119
int32 ClustersSize
Definition RecastNavMesh.h:121
int32 PolyClustersSize
Definition RecastNavMesh.h:122
int32 DetailTrisSize
Definition RecastNavMesh.h:117
int32 OffMeshSegsSize
Definition RecastNavMesh.h:120
int32 VertsSize
Definition RecastNavMesh.h:112
int32 TileSize
Definition RecastNavMesh.h:123
Definition RecastNavMesh.h:88
unsigned short ClusterCount
Definition RecastNavMesh.h:98
unsigned short DetailVertCount
Definition RecastNavMesh.h:93
unsigned short BvNodeCount
Definition RecastNavMesh.h:95
unsigned short OffMeshSegConCount
Definition RecastNavMesh.h:97
unsigned short DetailMeshCount
Definition RecastNavMesh.h:92
unsigned short PolyCount
Definition RecastNavMesh.h:90
unsigned short VertCount
Definition RecastNavMesh.h:89
unsigned short OffMeshBase
Definition RecastNavMesh.h:99
unsigned short OffMeshConCount
Definition RecastNavMesh.h:96
unsigned short MaxLinkCount
Definition RecastNavMesh.h:91
unsigned short DetailTriCount
Definition RecastNavMesh.h:94
Definition UnrealMathUtility.h:270
static UE_FORCEINLINE_HINT void * Memzero(void *Dest, SIZE_T Count)
Definition UnrealMemory.h:131
static FORCENOINLINE CORE_API SIZE_T GetAllocSize(void *Original)
Definition UnrealMemory.cpp:690
Definition NavigationTypes.h:453
Definition NavigationTypes.h:525
Definition LinkGenerationConfig.h:27
Definition NavigationTypes.h:150
uint64 GetId() const
Definition NavigationTypes.h:175
static ENGINE_API const FNavLinkId Invalid
Definition NavigationTypes.h:212
Definition NavigationTypes.h:252
Definition RecastNavMesh.h:547
FRecastNamedFiltersCreator(bool bVirtualFilters)
Definition RecastNavMesh.h:450
ENavigationInvokerPriority InvokerPriority
Definition RecastNavMesh.h:453
FIntPoint Coordinates
Definition RecastNavMesh.h:451
FVector::FReal InvokerDistanceSquared
Definition RecastNavMesh.h:452
Definition NavMeshPath.h:17
Definition RecastNavMesh.h:554
Definition RecastNavMesh.h:463
uint8 * GetMutableRawNavData()
Definition RecastNavMesh.h:486
const uint8 * GetRawNavData() const
Definition RecastNavMesh.h:485
FNavData(uint8 *InNavData, const int32 InDataSize)
Definition RecastNavMesh.h:467
SIZE_T AllocatedSize
Definition RecastNavMesh.h:496
~FNavData()
Definition RecastNavMesh.cpp:169
uint8 * RawNavData
Definition RecastNavMesh.h:495
void TestPtr() const
Definition RecastNavMesh.cpp:190
void Reset()
Definition RecastNavMesh.h:488
Definition RecastNavMesh.h:460
const uint8 * GetData() const
Definition RecastNavMesh.h:518
void MakeUnique()
Definition RecastNavMesh.cpp:236
~FNavMeshTileData()
Definition RecastNavMesh.cpp:211
uint8 * GetDataSafe()
Definition RecastNavMesh.h:524
FNavMeshTileData()
Definition RecastNavMesh.h:507
uint8 * Release()
Definition RecastNavMesh.cpp:220
bool operator==(const uint8 *RawData) const
Definition RecastNavMesh.h:529
uint8 * GetData()
Definition RecastNavMesh.h:512
FBox LayerBBox
Definition RecastNavMesh.h:501
int32 LayerIndex
Definition RecastNavMesh.h:500
int32 DataSize
Definition RecastNavMesh.h:503
TSharedPtr< FNavData, ESPMode::ThreadSafe > NavData
Definition RecastNavMesh.h:505
bool IsValid() const
Definition RecastNavMesh.h:534
Definition NavigationTypes.h:276
Definition NavigationData.h:87
Definition NavQueryFilter.h:39
Definition NavigationData.h:79
Definition NavigationTypes.h:612
Definition NavigationSystemTypes.h:62
Definition NavigationData.h:64
Definition UnrealType.h:7001
Definition UnrealType.h:6865
Definition RecastGraphAStar.h:73
Definition RecastNavMesh.h:349
Definition NumericLimits.h:41
Definition WeakObjectPtrTemplates.h:25
Definition IntPoint.h:25
static CORE_API const TVector< double > ZeroVector
Definition Vector.h:79
double FReal
Definition Vector.h:55
Definition DetourNavMesh.h:422