EdenSpark EdenSpark EdenSpark
/

Contents:

  • Getting Started
    • Start Here
    • Build Your First Game
    • Create Your Custom Mesh
    • UI Basics
    • Console Commands and Cheats
    • Hotkeys
    • User Menu
    • Debugger
    • daProfiler
    • Memory Profiler
    • Standalone Build
    • Linux Setup Guide
    • Vibecoding: Making Games with AI Tools
    • AI Generation Tool
    • Main loop
  • Editor
    • Main Menu
    • Preferences
    • Toolbar
    • Performance Monitoring
    • Viewport
    • Outliner
    • Inspector
    • Importer
    • Project Panel
    • Console
    • Code Editor
    • Drag and Drop
    • Notifications
    • Editor Scripting API
  • Scene
  • Resources
    • Models
      • Model Importing
      • Model Editor Tools
        • Model
        • Meshes
        • Physics
        • Materials
        • Animations
      • Model Scripting
      • Model Scripting API
    • Textures
      • Texture Importing
      • Texture Editor Tools
      • Texture Scripting
      • Texture Scripting API
      • CubeMaps and Skyboxes
    • Materials
      • Material Creation
      • Material Editor Tools
      • Material Scripting
      • Material Scripting API
      • Material Properties API
    • Shaders
    • Prefabs
      • Prefab Creation
      • Prefab Editor Tools
      • Prefab Scripting
      • Prefab Scripting API
    • Sounds
    • Fonts
    • Resources module
    • Mesh primitives
    • Create Mesh Async
  • System
  • Input
    • Input consts
    • Action set module
    • Raw input module
    • Global input state
  • Components
    • Components module
    • Render
      • Camera
      • Mesh
      • SpriteRenderer
      • ParticleSystem
      • LodSelector
      • Outline
      • Text3d
      • Sky
      • Ambient Settings
      • ShadowSettings
      • Tonemap
      • Bloom
      • Blur
      • AntiAliasing
      • SSAOSettings
      • SSRSettings
      • DistanceFog
      • RenderPipeline
    • Lights
      • DirectionalLight
      • PointLight
      • SpotLight
    • HD Render
      • HDGlobalIllumination
      • HDStaticShadows
      • HDSky
      • HDSkyOrigin
      • HDWater
      • HDDepthOfField
      • HDExposureAdaptation
    • Physics
      • RigidBody
      • Collider
      • CollisionListener
      • SpringJoint
      • HingeJoint
      • SixDofJoint
      • CharacterController
      • VehicleController
    • Animation
      • Animator
      • SingleAnimationPlayer
    • Navigation
      • Navmesh
    • Audio
    • UI
      • UICanvas
      • UIFrame
      • UIText
      • UIImage
      • UIMask
      • UIAnchor
      • UIButton
      • UICheckbox
      • UITextInput
      • UIDropdown
      • UISlider
      • UIScrollArea
      • UIHorizontalLayout
      • UIVerticalLayout
      • UIFlowLayout
      • UIContentSizeFitter
      • UIColorState
      • UITextureState
      • UIComponent, ui events
  • Physics
  • Math
    • Math module
    • Quaternion module
    • Random module
    • Noise module
    • Color module
    • Curve module
  • Time
  • Render
    • Render module
    • Debug render
    • Wireframe render
    • Pixel render
    • HD Renderer
    • UI
    • User Pixel Shaders
    • Shader Graph Nodes
    • Shader and Shader Graph Compiler
  • Sound
  • Local storage
  • Generic storage
  • JSON
  • Coroutines
  • Navigation
  • Behavior Tree
  • Free camera
  • Arcball camera
  • Tweener
    • Easing
    • Tween
  • Daslang’s documentation
    • Daslang 0.6.2 Reference Manual
      • 1. Introduction
      • 2. Design Philosophy
      • 3. The language
        • 3.1. Program Structure
        • 3.2. Lexical Structure
        • 3.3. Values and Data Types
        • 3.4. Pointers
        • 3.5. Constants, Enumerations, Global variables
        • 3.6. Statements
        • 3.7. Expressions
        • 3.8. Function
        • 3.9. Block
        • 3.10. Lambda
        • 3.11. Generator
        • 3.12. Struct
        • 3.13. Class
        • 3.14. Tuple
        • 3.15. Variant
        • 3.16. Bitfield
        • 3.17. Type Aliases
        • 3.18. Array
        • 3.19. Table
        • 3.20. Iterator
        • 3.21. Comprehension
        • 3.22. String Builder
        • 3.23. Modules
        • 3.24. Move, Copy, and Clone
        • 3.25. Clone
        • 3.26. Finalizer
        • 3.27. Temporary types
        • 3.28. Unsafe
        • 3.29. Generic Programming
        • 3.30. Pattern matching
        • 3.31. Annotations
        • 3.32. Options
        • 3.33. Macros
        • 3.34. Reification
        • 3.35. AST Matching
        • 3.36. Built-in Functions
        • 3.37. Lint Tools
      • 4. The Runtime
        • 4.1. Context
        • 4.2. Locks
        • 4.3. Very safe context
        • 4.4. Type Mangling
      • 5. Embedding and Integration
        • 5.1. Quick Start
        • 5.2. C++ API Reference
        • 5.3. C API Reference
        • 5.4. External Modules
        • 5.5. Project Files (.das_project)
        • 5.6. Advanced Topics
      • 6. LINQ-fold patterns — what _fold(...) recognizes
      • 7. daslang strudel vs strudel.cc — Feature Comparison
    • Daslang Standard Library 0.6.2
      • 1. Introduction
      • 2. Core
        • 2.1. Built-in runtime
        • 2.2. Math library
        • 2.3. Math bit helpers
        • 2.4. Boost package for math
        • 2.5. Random generator library
      • 3. Strings
        • 3.1. String manipulation library
        • 3.2. Boost package for string manipulation library
        • 3.3. Soft-failing string-to-numeric conversions returning Result<T; ConversionError>
        • 3.4. Temporary string utilities
        • 3.5. UTF-8 utilities
        • 3.6. Base64 encoding and decoding
        • 3.7. Long string embedding macro
      • 4. I/O and Serialization
        • 4.1. HTTP and WebSocket library (libhv)
        • 4.2. High-level HTTP and WebSocket wrappers
        • 4.3. URI manipulation library based on UriParser
        • 4.4. ANSI terminal color and style helpers
        • 4.5. General purpose serialization
        • 4.6. Command-line utilities
      • 5. Data Structures
        • 5.1. Boost package for array manipulation
        • 5.2. Boost package for the builtin sort
        • 5.3. Flat hash table
        • 5.4. Cuckoo hash table
        • 5.5. SOA (Structure of Arrays) transformation
        • 5.6. Packed boolean array
        • 5.7. Monadic Option<T> — a value-or-nothing tagged pair
        • 5.8. Monadic Result<T, E> — a value-or-error tagged pair
      • 6. Algorithms and Functional
        • 6.1. Miscellaneous algorithms
        • 6.2. Functional programming library
        • 6.3. LINQ
        • 6.4. Boost module for LINQ
        • 6.5. LINQ fold macros (_fold / _old_fold)
        • 6.6. Pattern matching
      • 7. Data Formats
        • 7.1. JSON manipulation library
        • 7.2. Boost package for JSON
        • 7.3. JSON-RPC 2.0 envelope + parser, transport-agnostic
        • 7.4. TOML 1.0 parser
        • 7.5. XML parser (pugixml)
        • 7.6. High-level XML helpers (pugixml boost)
        • 7.7. Regular expression library
        • 7.8. Boost package for REGEX
        • 7.9. PEG parser generator
      • 8. Entity Component System
        • 8.1. DECS, Daslang entity component system
        • 8.2. Boost package for DECS
        • 8.3. DECS debug state reporting
      • 9. Concurrency
        • 9.1. Jobs and threads
        • 9.2. Coroutines and additional generator support
        • 9.3. Async/await coroutine macros
      • 10. AST and Macros
        • 10.1. Runtime type information library
        • 10.2. decltype macro and template function annotation
        • 10.3. Constant expression checker and substitution
      • 11. Annotations and Contracts
        • 11.1. Miscellaneous contract annotations
        • 11.2. Apply reflection pattern
        • 11.3. defer and defer_delete macros
        • 11.4. with_ macro: locked array/table element binding
        • 11.5. if_not_null macro
        • 11.6. static_let macro
        • 11.7. lpipe macro
        • 11.8. Assert once
        • 11.9. Loop unrolling
        • 11.10. Bitfield operator overloads
        • 11.11. Bitfield name traits
        • 11.12. Enumeration traits
        • 11.13. Type trait macros
      • 12. Classes and Interfaces
        • 12.1. Class method macros
        • 12.2. instance_function function annotation
        • 12.3. Interfaces
        • 12.4. C#-like multicast delegate type macro
        • 12.5. Dynamic RTTI type casts
        • 12.6. Generic return type instantiation
      • 13. Testing and Debugging
        • 13.1. Debug agent API
        • 13.2. Debug expression evaluator
        • 13.3. Faker
        • 13.4. Fuzzer
        • 13.5. Debug Adapter Protocol data structures
      • 14. Code Quality and Refactoring
        • 14.1. Paranoid lint pass
        • 14.2. Repo-level lint configuration
        • 14.3. Code validation annotations
        • 14.4. Consume argument optimization
        • 14.5. Call argument removal annotation
      • 15. Image and Font Processing
        • 15.1. Image loading, writing, and resizing (stb_image)
        • 15.2. High-level image API (stbimage_boost)
        • 15.3. Raster operations (pixel copy, convert, SIMD gather/scatter)
        • 15.4. TrueType font loading and rasterization (stb_truetype)
        • 15.5. TrueType font API (stbimage_ttf)
      • 16. Audio and MIDI
        • 16.1. WAV file reading and writing
      • 17. Strudel (Live Coding)
        • 17.1. Event payload and ADSR/delay-time resolvers
        • 17.2. Cycle-space time primitives: TimeSpan, Hap, and cycle helpers
        • 17.3. Pattern algebra, combinators, and fluent control API
        • 17.4. Mini-notation tokenizer, parser, and fluent-DSL entry points
        • 17.5. Musical scales and note-name helpers
        • 17.6. Audio synthesis: oscillators, drums, filters, and effects
        • 17.7. Sample bank and audio file loading
        • 17.8. Voice allocation, effect bus routing, and per-tick mixing
        • 17.9. Top-level playback harness: tracks, BPM/CPS, and threaded audio
        • 17.10. MIDI file parser
        • 17.11. MIDI file playback with GM preset mapping
        • 17.12. SoundFont 2 file parser
        • 17.13. SoundFont 2 per-voice runtime: envelope, LFO, modulators, biquad
        • 17.14. Live-reload state preservation
  • Indices and tables

On this page

  • Baking a navmesh
  • Queries take a request struct
  • Finding a path
  • Following a route (NavCorridor)
  • Walkability raycast (trace)
  • Other queries
  • Agent profiles and groups
  • Selecting an agent profile
  • Enumerations
  • Structures
  • Functions
  1. EdenSpark /
  2. Navigation

Navigation¶

Bakes a navigation mesh from a scene’s static collider geometry and answers spatial queries over it – pathfinding, walkability raycasts, projection, distance to walls and random walkable points – so agents can move around obstacles instead of in straight lines.

A navmesh is defined by a NavMesh component on a node: that node’s subtree is the volume, and every Collider under it becomes walkable ground. The component also carries the agent parameters the mesh is built for – agentRadius, agentHeight, agentMaxClimb and agentMaxSlope – together with the voxel cellSize and cellHeight. To use this module:

require engine.navigation_core // or require engine.core

Basics of using the navmeshes (baking, pathfinding, walkability raycasts) are demonstrated in the NavMesh showcase sample.

Baking a navmesh¶

In the editor, add a NavMesh component to a node, place the walkable geometry (nodes with Collider components) under it, and press Bake in the inspector. The result is cached per prefab and reloaded automatically the next time the prefab is opened or played, so a bake survives a restart without an explicit save; Clear removes it again.

From script, bake the same volume through its component. The outcome arrives in the block once the bake finishes; treat the bake as asynchronous and do not rely on the block running within the call:

node?.NavMesh.bakeAsync() @(result : BakeResult) {
    if (result != BakeResult.Baked) {
        // react to a failed or empty bake
    }
}

The block receives BakeResult.Baked when a navmesh was produced, BakeResult.Empty when the bake ran but produced no walkable navmesh (no static Collider geometry under the node, or none of it was walkable; any previous navmesh of the volume is cleared), or BakeResult.Failed (with the reason logged) when the bake could not run at all. node?.NavMesh.isBaked tells whether the volume currently has a baked navmesh.

Queries take a request struct¶

Every query takes a request struct and calls a block with the result, mirroring the physics trace / overlap API. Struct fields have sensible defaults, so you only set what you need; a trailing ext field on the projecting queries is the half-extents of the box used to snap positions onto the navmesh (float3(0) derives it from the baked agent profile – widen it when click positions may land high above the walkable floor).

Finding a path¶

navmesh_find_path searches the baked navmeshes for a walkable route and, if one exists, calls the block with the waypoints in order (from..to):

var path : array<float3>
let res = navmesh_find_path(NavPathQuery(from = start, to = target)) $(p) {
    path := p
}

The result tells the three outcomes apart:

  • PathResult.Full – a complete route to the goal.

  • PathResult.Partial – the goal is unreachable (or the route hit the search limits); the path stops at the closest reachable point.

  • PathResult.NoPath – nothing walkable was found; the block is not called.

Following a route (NavCorridor)¶

navmesh_find_path gives waypoints to inspect or draw; to actually walk a route, use the stateful NavCorridor. It keeps the polygon corridor between the current position and the target and re-funnels from wherever the agent actually is every frame, so the steering never goes stale and the agent does not wedge on navmesh borders:

var corridor = NavCorridor()

// repath on demand
if (corridor.findPath(npc.localPosition, dest) != PathResult.NoPath) {
    walking = true
}

// every frame
if (walking) {
    let corners <- corridor.corners(2)
    let steerTo = length(corners) > 0 ? corners[0] : corridor.target
    let dir = steerTo - npc.localPosition
    if (corridor.movePosition(npc.localPosition + normalize(dir) * speed * get_delta_time())) {
        npc.localPosition = corridor.position
    } else {
        corridor.findPath(npc.localPosition, dest) // the navmesh was rebaked -- replan
    }
    if (corridor.distanceToGoal(1.0) <= 0.4) {
        walking = false // arrived
    }
}

moveTarget patches the corridor tail when the goal shifts nearby (chasing a moving target), optimize straightens the route when called a few times per second, isValid/reset manage the corridor lifetime. position and target are read-only properties: they are outputs of findPath/movePosition/moveTarget, so the corridor state can only move through those calls. Any navmesh rebake invalidates every outstanding corridor: movePosition returns false and the route must be rebuilt. See the NavMesh showcase sample for the full loop.

Walkability raycast (trace)¶

navmesh_trace casts a ray along the navmesh surface from req.from toward req.to. It answers “could an agent walk straight there”, not “what does a 3D ray hit”. The block is called only when a wall blocks the way:

let res = navmesh_trace(NavRayCast(from = pos, to = target)) $(hit) {
    // hit.position is the wall, hit.normal its XZ normal
}
if (res == NavMeshTraceResult.Reached) {
    // the straight line is walkable
} // NavMeshTraceResult.NotOnNavMesh: `from` is not on any baked navmesh

Other queries¶

  • navmesh_project_point(NavPointQuery(pos = p)) – snap a world position to the nearest point on a baked navmesh (height follows the navmesh surface); use it to validate click or spawn positions. The block receives the projected point.

  • navmesh_distance_to_wall(NavWallQuery(pos = p, maxRadius = r)) – the block receives the nearest wall (position, normal, distance); the return value is the distance (maxRadius when nothing is closer).

  • navmesh_random_points_around_circle(NavCircleQuery(center = c, radius = r, count = n)) – the block receives an array of random walkable positions reachable from the center.

  • navmesh_random_point(seed) – the block receives a random walkable position anywhere on the navmesh.

The random queries take a seed: 0 is non-deterministic (each call differs), any nonzero seed reproduces the same points for a given baked navmesh.

NavPathQuery also carries maxPathPoints (0 = unbounded): a cap on the waypoint count so a long query stays inside a frame budget. Hitting the cap returns PathResult.Partial with the route so far.

Agent profiles and groups¶

The bake groups tiles by agent profile – the full set of NavMesh parameters (agentRadius, agentHeight, agentMaxClimb, agentMaxSlope, cellSize, cellHeight). Every distinct profile gets its own baked navmesh. Two consequences follow:

  • Volumes baked with the same profile share one navmesh and are stitched together, so a path can run from one volume into an adjacent one.

  • Volumes baked with different profiles are separate navmeshes; a query for one profile never sees the other. Changing any parameter on a NavMesh component defines a new profile – if you tweak cellSize after baking, the old baked navmesh no longer matches and you must rebake.

A query selects its group by profile (see below). If no baked group matches the requested profile, that is a usage error: the query logs an error listing the requested profile and every baked profile (so the mismatch is obvious) and returns its empty result (NoPath / false / …). “No path on an existing navmesh” is a normal result and is not logged.

Selecting an agent profile¶

The module-level free functions query across every baked group. To route on a specific profile, call the same queries as methods of the NavMesh component whose parameters you want; they then run only on the navmesh baked for that profile, so a large agent follows the large-agent navmesh instead of the small one:

var path : array<float3>
let res = node?.NavMesh.findPath(NavPathQuery(from = a, to = b)) $(p) {
    path := p
}

findPath, trace, projectPoint, distanceToWall, randomPointsAroundCircle and randomPoint mirror the module-level functions above and report an error when no navmesh is baked for that profile.

Enumerations¶

BakeResult¶

Outcome of a navmesh bake. Delivered to the block passed to the NavMesh component method bakeAsync when the bake finishes.

Values:
  • Failed = 0 - The bake could not run at all (no physics world, bad parameters, or a build error); the reason is logged

  • Empty = 1 - The bake ran but produced no walkable navmesh (no static Collider geometry under the node, or none of it was walkable); any previous navmesh of the volume is cleared

  • Baked = 2 - A walkable navmesh was produced and added

NavMeshTraceResult¶

Outcome of a navmesh walkability raycast. Returned by navmesh_trace and the NavMesh component method trace.

Values:
  • NotOnNavMesh = 0 - The start position could not be projected onto any matching baked navmesh

  • Reached = 1 - The ray reached the end position without hitting a wall

  • Blocked = 2 - The ray hit a wall; the hit position and the wall normal are reported

PathResult¶

Outcome of a navmesh path search: tells a complete route apart from a truncated one. Returned by navmesh_find_path and the NavMesh component method findPath.

Values:
  • NoPath = 0 - No walkable path was found (no navmesh baked, endpoints off-mesh, or the search failed); the output array is emptied

  • Full = 1 - A complete route from start to end was found

  • Partial = 2 - The goal is unreachable (or the route hit the search limits); the returned path stops at the closest reachable point

Structures¶

NavCorridor¶

A stateful navmesh path corridor (Detour path-corridor semantics): holds the current position, the on-mesh target and, internally, the polygon corridor between them. This is THE primitive for moving an agent along a route: repath with findPath, then every frame pick the steering point and commit the step with movePosition - the corridor re-funnels from the current position each frame, so steering never goes stale. corners() can come back empty (stale corridor, never built, or every corner already consumed), so guard the access:

let corners <- corridor.corners(2)
let steerTo = length(corners) > 0 ? corners[0] : corridor.target

A navmesh rebake invalidates the corridor: movePosition returns false and isValid turns false - call findPath again.

position and target are read-only; they are updated only through findPath/movePosition/moveTarget.

NavCorridor.findPath(from: float3; to: float3): PathResult¶

def NavCorridor.findPath

Arguments:
  • from : float3

  • to : float3

NavCorridor.movePosition(want: float3): bool¶

def NavCorridor.movePosition

Arguments:
  • want : float3

NavCorridor.corners(max_corners: int = 4): array<float3>¶

def NavCorridor.corners

Arguments:
  • max_corners : int

NavCorridor.moveTarget(want: float3): bool¶

def NavCorridor.moveTarget

Arguments:
  • want : float3

NavCorridor.optimize(next_corner: float3; max_range: float = 6f): bool¶

def NavCorridor.optimize

Arguments:
  • next_corner : float3

  • max_range : float

NavCorridor.distanceToGoal(max_range: float = 100f): float¶

def NavCorridor.distanceToGoal

Arguments:
  • max_range : float

NavCorridor.isValid(): bool¶

def NavCorridor.isValid

NavCorridor.reset()¶

def NavCorridor.reset

Properties:

NavCorridor.position: float3¶

The corridor’s current on-mesh position. Read-only: updated by movePosition (and findPath).

NavCorridor.target: float3¶

The corridor’s on-mesh goal. Read-only: set by findPath, slid by moveTarget.

Functions¶

  • navmesh_distance_to_wall (req: NavWallQuery; blk: block<(hit:NavWallHit):void>) : float

  • navmesh_find_path (req: NavPathQuery; blk: block<(path:array<float3>):void>) : PathResult

  • navmesh_project_point (req: NavPointQuery; blk: block<(projected:float3):void>) : bool

  • navmesh_random_point (seed: int; blk: block<(point:float3):void>) : bool

  • navmesh_random_points_around_circle (req: NavCircleQuery; blk: block<(points:array<float3>):void>) : int

  • navmesh_trace (req: NavRayCast; blk: block<(hit:NavTraceHit):void>) : NavMeshTraceResult

navmesh_distance_to_wall(req: NavWallQuery; blk: block<(hit:NavWallHit):void>): float¶

Measures the distance from a position (projected onto the navmesh) to the nearest navmesh wall within req.maxRadius, and if a wall was found, calls the provided block for it.

Arguments:
  • req : NavWallQuery - the distance-to-wall request

  • blk : block<(hit: NavWallHit):void> - the block to call with the nearest wall (not called when no wall is within the radius)

Returns:
  • float - the distance to the nearest wall, req.maxRadius when no wall is that close, or a

negative value when req.pos is not on any baked navmesh

navmesh_find_path(req: NavPathQuery; blk: block<(path:array<float3>):void>): PathResult¶

Searches the baked navmeshes for a walkable route, and if one was found, calls the provided block with the waypoints in order (from..to).

Arguments:
  • req : NavPathQuery - the pathfinding request

  • blk : block<(path:array<float3>):void> - the block to call with the waypoint array (not called on PathResult.NoPath)

Returns:
  • PathResult - PathResult.Full for a complete route, PathResult.Partial when the goal is

unreachable (or req.maxPathPoints was hit) and the path stops at the closest reachable point, PathResult.NoPath when nothing walkable was found

Usage example:

let res = navmesh_find_path(NavPathQuery(from = start, to = target)) $(p : array<float3>) {
    path := p // follow the waypoints
}
let complete = res == PathResult.Full
navmesh_project_point(req: NavPointQuery; blk: block<(projected:float3):void>): bool¶

Projects a world position onto the nearest point of a baked navmesh (height follows the navmesh surface), and if the position is close enough, calls the provided block with the result. Useful to validate click/spawn positions before pathfinding.

Arguments:
  • req : NavPointQuery - the projection request

  • blk : block<(projected:float3):void> - the block to call with the projected point (not called when nothing is close enough)

Returns:
  • bool - true when req.pos is close enough to a baked navmesh

Usage example:

navmesh_project_point(NavPointQuery(pos = clickPos)) <| $(projected) {
    spawnPos = projected
}
navmesh_random_point(seed: int; blk: block<(point:float3):void>): bool¶

Picks a random walkable position anywhere on the baked navmesh (polygons weighted by area), and if one was produced, calls the provided block with it.

Arguments:
  • seed : int - random seed; 0 is non-deterministic (each call differs), any nonzero seed reproduces the same point

  • blk : block<(point:float3):void> - the block to call with the random position (not called when nothing is baked)

Returns:
  • bool - true when a point was produced

navmesh_random_points_around_circle(req: NavCircleQuery; blk: block<(points:array<float3>):void>): int¶

Generates up to req.count random walkable positions reachable from req.center within req.radius (the circle limits the visited polygons, so points are not exactly distance-constrained), and if any were produced, calls the provided block with the array.

Arguments:
  • req : NavCircleQuery - the random-points request

  • blk : block<(points:array<float3>):void> - the block to call with the generated points (not called when none were produced)

Returns:
  • int - the number of points produced (0 when req.center is not on any baked navmesh)

Usage example:

navmesh_random_points_around_circle(NavCircleQuery(center = pos, radius = 8.0, count = 5)) <| $(points : array<float3>) {
    for (p in points) { spawn_enemy(p); }
}
navmesh_trace(req: NavRayCast; blk: block<(hit:NavTraceHit):void>): NavMeshTraceResult¶

Casts a “walkability” ray along the navmesh surface from req.from toward req.to - tells whether an agent could walk in a straight line, not what a 3D ray would hit - and if a wall blocks the way, calls the provided block for the resulting hit.

Arguments:
  • req : NavRayCast - the raycast request

  • blk : block<(hit: NavTraceHit):void> - the block to call with the wall hit (called only on NavMeshTraceResult.Blocked)

Returns:
  • NavMeshTraceResult - NavMeshTraceResult.Reached when the straight line is walkable, NavMeshTraceResult.Blocked

when a wall is in the way, NavMeshTraceResult.NotOnNavMesh when req.from is not on any baked navmesh

Usage example:

navmesh_trace(NavRayCast(from = pos, to = target)) <| $(hit) {
    print("wall at {hit.position}, normal {hit.normal}")
}
Previous
Coroutines
Next
Behavior Tree

2026 Gaijin Games Kft. All trademarks, logos, and brand names are the property of their respective owners.

Made with Sphinx and Shibuya theme.