Sein Navigation
Class · USeinNavigation : UObject
#include "SeinNavigation.h"
abstract: use a subclass
Abstract base for navigation implementations: pathfinding, reachability, ground height and terrain queries, and placement checks over the baked level grid. Choose the class with Navigation Class in the Navigation settings. The shipped implementation is the A* navigation.
C++ members (45)
bool HasRuntimeData() const;True if the nav has usable runtime data (loaded from the unified substrate or procedurally initialized). Queries return no-path when false. Default: false — subclasses report their own grid state.uint64 GetStaticEnvironmentGeneration() const;Counter bumped by every static-environment mutation. Debug viewers use it as a cache key; implementations that do not track mutations return 0.ISeinLevelLayerProvider* GetLevelDataProvider();This nav’s layer-provider face, or null if it contributes no channel to the unified level-data bake. The nav subsystem registers a non-null result so the shared bake runs this nav’s BakeLayer. Default: null (doesn’t participate).FSeinStaticEnvironmentAdoptionResult LoadFromSubstrate(const USeinLevelData& Substrate);Load runtime topology from the unified substrate. This public mutation front door is owner-guarded: once the match has started it rejects before subclass state can change. Custom implementations override LoadFromSubstrateImpl below, not this gate. NotApplicable is a valid no-data/non-participating outcome; Rejected carries the precise reason bootstrap must fail rather than silently accepting an empty topology.bool FindPath(const FSeinPathRequest& Request, FSeinPath& OutPath) const;Synchronous path query. Subclasses override. Default: returns an invalid path. Single entry point for path consumers (BPFL queries, reachability checks, the budgetedUSeinNavigationSubsystem::RequestPath path). What the subclass produces is its own concern — barebones nav returns a polyline; a subclass may layer in project-specific post-processing (extra wall padding, maneuver shaping) before returning.void RunPathBatch(const TArray<FSeinPathRequest>& Requests, TArray<FSeinPath>& OutResults) const;Run a batch of path requests. The async-pathfinding drain calls this so a nav impl can parallelize the batch internally (per-thread scratch). Default: SERIAL — loops FindPath, so any nav works unchanged (a non-reentrant impl simply doesn’t parallelize).USeinNavigationAStaroverrides it to run the searches across worker threads. OutResults is sized to Requests and filled index-aligned; each result must be a pure function of its request + the immutable grid.bool FindCellPath(const FSeinPathRequest& Request, FSeinPath& OutPath) const;Cell-level path query — pure 2D pathfinding on the clearance grid. Output is a cell-aware polyline: smoothed (LoS-collapsed) and segment-derived as straight segments. Used directly by movement modes that don’t need curve-aware paths (USeinBasicMovement), and as a building block by nav subclasses that call this internally from their FindPath override before layering on project-specific post-processing. Default: clears OutPath and returns false. The default nav impl (USeinNavigationAStar) overrides this with the real 2D A* search.FFixedVector QueryDirection(const FSeinDirectionQuery& Query) const;Direction-query seam — the “pull” complement to FindPath’s “push” route. Returns a planar UNIT direction the agent at Query.From should head to progress toward Query.Goal, or ZERO if it should stop (arrived / no direction / no data). This is the seam a FIELD-shaped nav (flow field / continuum crowds) answers NATIVELY — it samples its precomputed per-cell field at From instead of producing a per-agent route — and the seam a field-follower movement mode consumes each tick. A ROUTE-shaped nav answers it by routing and returning the first step’s heading (USeinNavigationAStardoes this). Query.GroupId lets a field nav share ONE field across an ordered group (key by GroupId + Goal); per-agent navs ignore it. Base default: straight-line toward Goal (obstacle-BLIND) — a safe fallback so any nav answers SOMETHING; override for obstacle-aware or field-based direction. Movement steps call this in parallel to follow a Field segment, so a navigation that emits Field segments answers them without writing shared state: build fields when routes are planned, which runs serially, and only read them here.USeinNavigationAStarroutes on the game thread and never emits Field segments.bool IsReachable(const FFixedVector& From, const FFixedVector& To, const FGameplayTagContainer& AgentTags) const;Tag-only reachability seam. The tags describe the agent’s capabilities/classification for custom navigation implementations; they are not terrain exclusions. The default forwards to the complete-profile query with otherwise neutral policy. New entity-aware command validation uses IsReachableForAgent so authored blocked terrain, body clearance, and wall padding cannot be lost.bool IsReachableForAgent(const FFixedVector& From, const FFixedVector& To, const FSeinNavAgentProfile& Agent) const;Agent-complete reachability gate used by authoritative command validation. The default runs an exact unbudgeted path request and rejects partial results. Implementations may override with an equivalent cached connectivity query, but must honor the complete profile. Dynamic blockers may be ignored here because this asks fundamental reachability, not whether a transient doorway is clear on this tick.void WarmAgentProfile(const FSeinNavAgentProfile& Agent) const;Optional loading/spawn-time performance hook. Implementations with profile-specific derived topology may prepare it here so the first player order does not pay an O(map) cache build. Purely derived state: this must never change navigation answers or canonical simulation state.bool GetRandomReachablePoint(const FFixedVector& Origin, FFixedPoint Radius, FFixedRandom& Rng, FFixedVector& OutPoint) const;Find a random walkable world point within Radius of Origin that is REACHABLE from Origin (same static nav region — uses the same component notion as IsReachable). Deterministic: draws from the suppliedFFixedRandomstream and ADVANCES it, so the caller owns the seed (lockstep-safe as long as the seed is deterministic — e.g. derived from entity handle + tick). Best-effort: returns false if no reachable point turns up within the impl’s attempt budget (very sparse region / tiny radius) or the nav has no runtime data. OutPoint is left untouched on false. Default: false (a nav that doesn’t support it degrades to “no point”).USeinNavigationAStaroverrides with disc rejection-sampling against the connectivity-component field.bool NavRaycast(const FFixedVector& From, const FFixedVector& To, FFixedVector& OutHitPoint) const;Trace a straight line on the STATIC nav grid from From to To. Returns true if the line is BLOCKED before reaching To, with OutHitPoint set to the first blocked point; returns false (clear) with OutHitPoint = To if the whole line is traversable. A cheap grid walk — NOT a pathfind (no detour). Default: clear (no data).USeinNavigationAStaroverrides with a Bresenham + connectivity walk.int32 GetTerrainTypeAt(const FFixedVector& WorldPos) const;The baked terrain-type index at a world position (0 = Default / off-grid / no data). The neutral shared per-cell classification the level bake stamped — movement reads it to scale traversal speed (viaUSeinLevelSettings::GetTerrainSpeedMultiplier); A* read the same type for routing cost at BAKE time. Default: 0 (a nav with no terrain data is all-Default).USeinNavigationAStaroverrides with the runtime grid lookup.bool IsPassable(const FFixedVector& WorldPos) const;True if a world-space point is inside the nav’s walkable region. Default: false. Subclasses override.bool IsWorldPositionClear(const FFixedVector& WorldPos, uint8 AgentNavLayerMask) const;True if a unit could occupy this world position RIGHT NOW, considering BOTH the static bake AND the current dynamic blockers (bBlocksNav stamps) whose BlockedNavLayerMask intersects AgentNavLayerMask. Distinct from IsPassable (static bake only) and from the per-FindPath dynamic overlay (transient). Destination providers use this to reject points on a cell ANY wall — baked OR runtime-dynamic — occupies, so units are never dispatched onto an unreachable spot. Default: static-only (delegates to IsPassable);USeinNavigationAStaroverrides with dynamic-blocker awareness.bool IsWorldPositionClearForAgent(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent) const;Agent-complete occupancy query. The base combines the implementation’s static/dynamic layer query with the authored blocked-terrain policy. This checks one point; body occupancy belongs in the footprint or ground-capsule query below.bool IsWorldPositionClearForAgentCached(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent, FSeinNavPointQueryCache& Cache) const;Same ordinary point predicate with caller-owned certificate scratch. The default preserves arbitrary custom predicates without memoization.bool IsFootprintClearForAgent(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent) const;Complete agent footprint. Native A* checks the filled disc; custom implementations default to their center plus eight-sample body ring.bool IsFootprintClearForAgentIgnoringDynamicBlockers(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent, const TSet<FSeinEntityHandle>& IgnoredDynamicBlockerOwners) const;Formation-only footprint query. Owners in the ignore set are members of the same pending order and therefore vacate their current dynamic blocker stamps. Implementations without owner-addressable runtime blockers may use the ordinary complete-agent result.bool IsDestinationAdmittedForAgent(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent) const;Whether this point is a valid route destination for the complete agent. Native A* includes graph clearance and step/slope boundaries; physical footprint queries remain independent of that route policy.bool IsDestinationAdmittedForAgentIgnoringDynamicBlockers(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent, const TSet<FSeinEntityHandle>& IgnoredDynamicBlockerOwners) const;Destination admission excluding only the runtime stamps of members that will vacate as part of the same formation order.bool IsAuthoritativeDestinationSafeForAgent(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent) const;Whether an authoritative destination may safely overrule only the coarse static bake at this point. Terrain forbidden by the agent must still fail; implementations with dynamic blockers override to reject those too.bool IsAuthoritativeFootprintSafeForAgent(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent) const;Footprint form of authoritative safety. Static bake obstruction may be ignored, but no footprint sample may overlap agent-forbidden terrain or a dynamic blocker.FFixedPoint GetCellSize() const;World units per nav grid cell. Used by callers that need to align to actual grid edges (e.g. extracting axis-aligned passable/impassable boundary segments for wall-constraint generation). Default: 100 (a sane fallback when the nav doesn’t expose a real grid). Subclasses with a known cell pitch should override.FFixedPoint GetEndpointConnectorRadius(FFixedPoint BodyRadius) const;Connectors to authoritative destinations cross the raster margin; live geometry still blocks them.bool IsPlacementValid(const FFixedVector& CenterWorld, FFixedPoint YawDegrees, const FSeinExtentsShape& Shape, uint8 AgentLayerMask) const;Test whether a building footprint can be placed at the given pose without overlapping blocked cells. Used by the targeter’s footprint placement resolver gate; ability validation calls this through the cross-module delegate registered onUSeinWorldSubsystem(seeFSeinFootprintPlacementResolver). CenterWorld: anchor world position the footprint occupies YawDegrees: rotation around vertical axis (drives Box footprint axes; ignored for Capsule) Shape: theFSeinExtentsShapethat will occupy cells (Box or Capsule) AgentLayerMask: nav layer mask used for blocking checks Default impl: walks every cell-center inside the shape’s XY extent and tests IsPassable on each. Subclasses can override with cheaper grid-AABB or rasterization-based tests if the per-cell IsPassable cost is too high (typical buildings are 4×4..8×8 cells = 16..64 calls — not a hot path, but easy to specialize for nav impls that already rasterize). Returns true when every covered cell is walkable for the layer mask. False when any cell is blocked OR the nav has no runtime data (no bake → can’t validate → conservative reject).bool QueryEscapeTarget(const FSeinEscapeQuery& , FFixedVector& ) const;Find a nearby “escape” target for an agent that is mechanically stuck — its applied movement step has been ~zero against a blocked footprint while its order keeps commanding motion. Consumed by SeinMoveToAction’s hold-escape ladder: the action steers the unit to the returned target as a short internal leg, then resumes normal pathing from the freed position. CONTRACT: a returned target must be CURRENTLY reachable by the STRAIGHT leg the consumer drives — the target and the segment From→target clear of static bake AND dynamic blockers (per Query.AgentNavLayerMask), the agent’s FOOTPRINT (Query.AgentFootprintRadius) fitting at the target, and no terrain class the agent blocks (Query.BlockedTerrainTags) — or the movement floor will refuse the escape leg and convert a curable hold into a Stranded fail. No answer: return false with OutTarget untouched (same convention as GetRandomReachablePoint); the action’s exhaustion path stays bounded either way.USeinNavigationAStaroverrides with a WallDistance- gradient walk.bool ProjectPointToNav(const FFixedVector& WorldPos, FFixedVector& OutProjected) const;Snap a point to the nearest walkable cell — the PLAIN projection (for the elevation- and occupancy-aware variants, see ProjectPointToNavOnElevation and ProjectPointToNavFree). Returns false if no walkable point is within the nav’s reachable region. Default: passes the point through unchanged + returns HasRuntimeData().bool ProjectPointToNavForAgent(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent, FFixedVector& OutProjected) const;Nearest position valid for this complete agent profile. Unlike the plain projection, the result must respect blocked terrain, dynamic nav layers, body clearance, and wall padding.bool ResolveReachableDestinationForAgent(const FFixedVector& From, const FFixedVector& Desired, const FSeinNavAgentProfile& Agent, FFixedVector& OutResolved) const;Resolve a movement destination from this agent’s origin. A partial route supplies the closest reachable endpoint before preview and command submission.bool ProjectReachableDestinationForAgent(const FFixedVector& From, const FFixedVector& Desired, const FSeinNavAgentProfile& Agent, const TSet<FSeinEntityHandle>& IgnoredOwners, const TArray<FFixedVector>& AvoidCentres, const TArray<FFixedPoint>& AvoidRadii, FFixedVector& OutResolved) const;bool ProjectPointToNavOnElevation(const FFixedVector& WorldPos, FFixedVector& OutProjected) const;Snap to the nearest walkable cell AT the input’s elevation — the elevation-aware step up from ProjectPointToNav, preferring cells whose stored height is close to WorldPos.Z. When the input lands at a platform edge, regular ProjectPointToNav would snap to the nearest XY passable cell — which on most baked grids is the lower floor cell because cells are indexed by XY only. This Z-biased version expands the search to find a cell at the input’s elevation, falling back to plain XY projection only when no elevation-matching cell exists in scan radius. Used by formation slot resolution so a click on a raised platform produces destinations ON the platform — without it, slots that fan over the edge of the platform place members on the floor below, producing stragglers running off cliffsides. Default: falls back to ProjectPointToNav (no Z bias). Subclasses whose grid stores per-cell heights override to do the actual Z-tolerance scan.bool ProjectPointToNavFree(const FFixedVector& WorldPos, FFixedPoint SelfRadius, const TArray<FFixedVector>& AvoidCentres, const TArray<FFixedPoint>& AvoidRadii, FFixedVector& OutProjected) const;Snap to the nearest walkable cell at the input’s elevation that is ALSO FREE of the given footprints — the occupancy-aware step up from ProjectPointToNavOnElevation. Rejects any candidate cell whose centre is within SelfRadius + AvoidRadii[j] of AvoidCentres[j], i.e. the nearest walkable free cell. The formation layer feeds the already-placed slots as the avoid set so an off-nav slot snaps onto the inside edge of the play area without piling onto a peer (occupancy-aware nearest-free-cell). AvoidCentres / AvoidRadii are index-aligned; a missing radius counts as zero. Falls back to a free-but-any-elevation cell, then to a plain occupancy-blind projection, so a slot is never dropped. Default: ignores avoidance and defers to ProjectPointToNavOnElevation. Subclasses whose grid stores per-cell heights override to do the real occupancy-aware scan.bool ProjectPointToNavFreeForAgent(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent, const TArray<FFixedVector>& AvoidCentres, const TArray<FFixedPoint>& AvoidRadii, FFixedVector& OutProjected) const;Occupancy-aware agent projection used for heterogeneous formation slots. Default implementations may ignore peer occupancy only as a last-resort fallback, but may never return a position forbidden by Agent.bool ProjectPointToNavFreeForAgentIgnoringDynamicBlockers(const FFixedVector& WorldPos, const FSeinNavAgentProfile& Agent, const TSet<FSeinEntityHandle>& IgnoredDynamicBlockerOwners, const TArray<FFixedVector>& AvoidCentres, const TArray<FFixedPoint>& AvoidRadii, FFixedVector& OutProjected) const;Formation-only agent projection with exact dynamic-blocker owner exclusions. Static nav, terrain policy, wall clearance, and the supplied peer-footprint avoidance remain in force.bool IsGroundCapsuleClearForAgent(const FFixedVector& From, const FFixedVector& To, FFixedPoint Radius, const FSeinNavAgentProfile& Agent, bool bIgnoreStatic = false, int32* RemainingProbes = nullptr, FSeinNavPointQueryCache* PointCache = nullptr) const;Ground footprint swept between two nearby centers. Native grid navigation checks every intersected cell; custom navigation retains its point-query semantics through the center/rim fallback. IgnoreStatic admits authoritative destinations, but never bypasses terrain or dynamic blockers. RemainingProbes charges one unit per nine candidate grid cells (at least one), including cached cells. Exhaustion sets it to -1 and rejects the step.bool GetCellHeightAt(const FFixedVector& WorldPos, FFixedPoint& OutZ, bool bWalkableOnly = true) const;Sample the baked top-of-surface Z at a world-space XY. bWalkableOnly = true (default): refuses on blocked cells (cube tops, wall footprints, pruned islands). The refusal is deliberate for ground movement: prevents units from Z-snapping onto wall tops as they slide across blocked-cell slivers (path smoother corner- cuts, vehicle turn arcs). Returning false leaves the unit’s previous-tick Z in place — keeps them on the floor instead of popping onto the wall. bWalkableOnly = false: returns the top of whatever’s in the cell regardless of passability — building roof, wall top, steep-slope hit point. The bake already stores it per cell (one downward trace per cell, top hit recorded). Used by flying movements: flyer Z = surface + Altitude automatically clears anything in the cell. Returns false in either mode for out-of-bounds XY.void DrawDebug(UWorld* World) const;Optional debug hook. The framework does not dispatch this method. Shipped grid visualization uses CollectDebugCellQuads and its scene proxy; movement paths use the per-view Canvas overlay.uint32 GetDebugAppearanceHash() const;Presentation cache key for implementation-specific cell appearance settings.void CollectDebugCellQuads(TArray<FVector>& OutCenters, TArray<FColor>& OutColors, float& OutHalfExtent) const;Collect the nav’s cell geometry for scene-proxy rendering. Subclasses emit one quad per cell (XY-plane, slightly above the cell height) with a per-cell color (green = walkable, red = blocked). Default: no cells. Called byUSeinNavDebugComponent::CreateSceneProxy. The custom SeinNavigation flag controls visibility. The proxy captures the arrays, so this is NOT a per-frame hot path — only runs on load / bake / mutation. In UE_BUILD_SHIPPING subclass overrides become no-ops (method bodies are guarded by UE_ENABLE_DEBUG_DRAWING). The declaration stays for vtable / ABI consistency.void CollectDebugPathCells(const TArray<FFixedVector>& CellPathWorld, TArray<FVector>& OutRouteCells, TArray<FVector>& OutDestCell, float& OutHalfExtent) const;Raw-cell geometry utility. CellPathWorld is search data captured before smoothing, not remaining driven geometry. The Canvas path overlay uses committed waypoints/segments and does not call this utility. - OutRouteCells: every cell of the chain EXCEPT the last (excluded to avoid double-draw). - OutDestCell: the final (destination) cell, drawn with a distinct marker color. Empty if none. Same stripping convention as CollectDebugCellQuads.void CollectDebugBlockerCells(TArray<FVector>& OutCenters, TArray<FColor>& OutColors, float& OutHalfExtent) const;Collect cells currently stamped by dynamic nav blockers (tanks, vehicles, buildings under construction, etc.). Called on scene-proxy rebuild after mutation or viewer activation. Emits one (Center, Color) pair per cell — Color resolves from the blocker’s BlockedNavLayerMask against plugin-settings layer colors so the viz uniformly reflects what each blocker is gating, regardless of whether the layer- perspective filter is on. Subclasses with no dynamic-blocker support emit nothing (default). Same shipping-strip convention as the other debug collectors.FSeinNavAgentProfile GetPlanningAgent(const FSeinNavAgentProfile& Agent) const;Resolve planning-only blocker exclusions. Never apply to physical admission.bool MayHavePlanningBlocker(const FFixedVector& From, const FFixedVector& To, FFixedPoint Padding, const FSeinNavAgentProfile& Agent) const;Conservative broad phase; false means no runtime blocker can intersect this route leg.