# Navigation > **Notice:** The complete sample source code is available on GitHub: > **[github.com/unigine-engine/csharp-component-samples](https://github.com/unigine-engine/csharp-component-samples)**. ## Experimental Navigation Mesh This sample demonstrates how to configure pathfinding between two points with obstacles using **[Experimental Navigation Mesh](../../../objects/navigations/experimental/navigation_mesh/index.md)**. The route is built for an agent of a certain size, so a path is only found where the agent actually fits: it keeps clear of walls and obstacles, avoids slopes too steep to walk up and steps too high to climb, and gives up when the way around becomes too long. The resulting route is reported with its length, cost, and number of points, and if the target cannot be reached, the path is drawn up to the last point the agent can get to, with the reason explained. This sample is useful for pathfinding in games, for route checks in training simulators and digital twins, and for verifying that a building model stays passable for a given size. The following parameters can be adjusted at run time: - **Straight mode** - how detailed the resulting path is: only the corners it turns at, those corners plus the points where it moves between areas, or every polygon it crosses along the way - **Heuristic scale** - the search accuracy: 1 gives the shortest path, higher values find a path faster but not necessarily the best one - **Max cost** and **Max search nodes** - the budgets of the search: when the budget of either parameter is exhausted, the search stops and the route stays partial - **Agent radius** and **Agent height** - the width and the height of the agent the route is planned for - **Max slope angle** and **Max step height** - how steep a slope and how high a step that agent can manage - **Snap size** - how far off the navigation mesh the start and end points may be and still snap onto it - **Consider obstacles** - whether obstacles block the route or are ignored - **Show Navigation Mesh** - draws the navigation mesh itself, colored by the areas of its polygons. The route is requested through *[ExperimentalNavigationPathFetch](../../../api/library/pathfinding/class.experimentalnavigationpathfetch_cpp.md)*, and all the agent parameters are set on the *[ExperimentalNavigationMeshFilter](../../../api/library/pathfinding/class.experimentalnavigationmeshfilter_cpp.md)* it is given: the same filter decides which navigation mesh suits the agent and how the route is searched. The result comes back as an *[ExperimentalNavigationPath](../../../api/library/pathfinding/class.experimentalnavigationpath_cpp.md)*, which carries the points, the length, the cost, the status, and the failure reason explaining why an incomplete route stops where it does. **SDK Path:***/data/csharp_component_samples/navigation/experimental_navigation_mesh* ## Experimental Navigation Mesh Character This sample demonstrates an animated character walking to a target over an **[Experimental Navigation Mesh](../../../objects/navigations/experimental/navigation_mesh/index.md)**. The character's movement along the route is taken from the [root motion](../../../content/animations/root_motion/index.md) of the locomotion animations. Drag the target material ball with the manipulator and the character replans their route and walks to the new place. The locomotion settings can be adjusted in the *Parameters* section. The *Status* block reports the route state, the current animation state, the velocity the character actually moves at, and the rate the walk animation is played at. This sample is useful for animated agents navigating a scene: characters in games, pedestrians in a simulation, any unit whose animation is expected to drive its movement. The character is driven by the reusable *ExperimentalSeekerCharacter* component, which inherits the navigation part from *ExperimentalSeeker*: the route is requested through *[ExperimentalNavigationPathFetch](../../../api/library/pathfinding/class.experimentalnavigationpathfetch_cpp.md)* and followed with *[ExperimentalNavigationMeshCorridor](../../../api/library/pathfinding/class.experimentalnavigationmeshcorridor_cpp.md)*, which keeps the agent on the mesh. *ExperimentalSeekerCharacter* expects a locomotion [state machine](../../../content/animations/state_machines/index.md) with root motion enabled, and drives it through three parameters: a flag telling the character to walk, the playback rate of the locomotion animations, and the turn-in-place request. The states are recognized by their names containing *idle*, *turn* and *stop*. The locomotion settings shape how the animations are picked and played: - **Movement speed** - the walking speed. The animations are played faster or slower to match it, and the component measures their root motion speed as the character walks, so it needs no tuning by hand - **Rotation speed** - how fast the character may turn while walking. The walk animation goes straight, so the component turns the node itself to follow the route - **Turn angle** - the largest turn the character makes without stopping. A sharper turn is played as the turn-in-place animation instead - **Stop distance** - how far from the end of the route the stop animation starts. The stop animation travels a fixed distance of its own, so starting it any later would overshoot the target - **Reach distance** - how close to the target the character counts as arrived. With a small value the character can overshoot the target and stop past it - **Show Seeker Debug** - draws the route the character follows, and a red line straight to the target when it cannot be reached - **Show Navigation Mesh** - draws the navigation mesh itself, colored by the areas of its polygons **SDK Path:***/data/csharp_component_samples/navigation/experimental_navigation_mesh_character* ## Experimental Navigation Mesh Conversion This sample demonstrates how navigation data can be moved between the classic **[Navigation Mesh](../../../objects/navigations/navigation/navigation_mesh/index.md)** and the **[Experimental Navigation Mesh](../../../objects/navigations/experimental/navigation_mesh/index.md)**. Both are baked by the same [experimental navigation baker](../../../api/library/pathfinding/class.experimentalbakenavigation_cpp.md) from one shared set of settings over the same scene geometry, so the two results can be compared side by side. Their data, however, is kept in different formats: the classic node stores a polygon mesh in a `.mesh` file, the experimental one a tiled `.navmesh` asset. The sample converts the data of one node into the format of the other: the classic mesh can be converted into the experimental format and back in memory, or exported to a `.mesh` file. The experimental system bakes the walkable surface from the scene geometry instead of areas placed by hand, streams it in tiles for worlds too large to fit in memory, and supports area volumes with their own cost. This sample is useful when moving a project to the new navigation system: the navigation already prepared for the classic node can be carried over as it is, and the two systems can run side by side while the migration is in progress. The **Bake settings** group holds one set of parameters shared by both meshes. The values are pushed to the nodes right before a bake, so changing them does not invalidate the data already loaded from the assets: - **Agent radius** and **Agent height** - the dimensions of the agent: the walkable surface is shrunk from the boundaries by the radius, and the areas with a lower ceiling are excluded - **Max slope angle** and **Max step height** - the steepest slope that still counts as walkable and the highest ledge the agent can step over - **Cell size** and **Cell height** - the size of the voxelization cell: smaller cells give a more precise mesh at the cost of the bake time - **Tile resolution** - the size of one navigation mesh tile in cells - **Partitioning** - the algorithm splitting the walkable surface into regions: watershed gives the best quality, monotone is the fastest, chunky is a tradeoff for tiled meshes - **Region min size** and **Region merge size** - isolated regions smaller than the first value are discarded, the ones smaller than the second are merged with the neighbors when possible - **Max edge error** - the maximum deviation of the simplified mesh boundary from the raw contour - **Detail distance** and **Detail error** - the sampling distance and the maximum elevation error of the detail mesh following the ground - **Show bake bounds** - draws the bake bounds of each mesh: green for the classic node, blue for the experimental one. The navigation meshes themselves are always visualized, so the results of the operations can be compared side by side The operations available for each mesh: - **Bake from scene** - bakes the experimental navigation mesh from the scene geometry asynchronously, reporting the progress, the number of tiles built, and the elapsed time - **Convert from classic** - converts the data of the classic mesh into the experimental format - **Save** - writes the polygon mesh of the experimental navigation mesh to a `.mesh` file chosen in the file dialog, in the format the classic node reads - **Bake with new baker** - bakes the classic navigation mesh from the same scene geometry, into its own separate asset so the original one stays intact - **Apply from experimental** - sets the polygon mesh of the experimental navigation mesh to the classic node directly in memory - **Load** - reads a `.mesh` file into the classic navigation mesh The conversion operations are self-contained functions that depend only on the Engine API, so any of them can be copied into a project. Baking from the scene runs asynchronously through *[bakeAsync()](../../../api/library/pathfinding/class.experimentalbakenavigation_cpp.md#bakeAsync_ExperimentalNavigationMesh_ExperimentalNavigationBakeQuery)*, which returns a bake query: the sample polls it for progress and reads the result once the bake is done. Converting the classic mesh into the experimental format goes through the scene, which is what the baker reads: the polygon mesh taken from the classic node with *[getMesh()](../../../api/library/pathfinding/class.navigationmesh_cpp.md#getMesh_Mesh_int)* is spawned as temporary procedural geometry aligned with the experimental node, then baked by *[bakeForce()](../../../api/library/pathfinding/class.experimentalbakenavigation_cpp.md#bakeForce_ExperimentalNavigationMesh_int)* under a dedicated bake mask that keeps the rest of the scene out. The agent radius is zeroed for that bake, since the classic mesh is already shrunk by it. The opposite direction is direct: the polygon mesh is read from the experimental node and passed to the classic one with *[setMesh()](../../../api/library/pathfinding/class.navigationmesh_cpp.md#setMesh_Mesh_int)*. The same mesh can be written to a file with *[Mesh](../../../api/library/rendering/class.mesh_cpp.md)* and read back into the classic node with *[loadMesh()](../../../api/library/pathfinding/class.navigationmesh_cpp.md#loadMesh_cstr_int)*. **SDK Path:***/data/csharp_component_samples/navigation/experimental_navigation_mesh_conversion* ## Experimental Navigation Mesh Crowd This sample demonstrates a crowd of agents moving over an **[Experimental Navigation Mesh](../../../objects/navigations/experimental/navigation_mesh/index.md)**, each one planning its own route and steering around the others on the way. Before an agent moves, it evaluates its neighbors and adjusts its speed and direction to avoid a collision. The crowd starts with a hundred agents and can be restarted with ten to three hundred. The sample provides three navigation scenarios: - **Bottleneck** - two teams on the opposite sides of a wall swap places, each agent taking the shortest route through the gates - **Circle** - the agents are placed on a circle and head for its diametrically opposite point - **Wander** - the agents walk between random points of the mesh The *Status* block reports the current scenario, the number of agents, and how many goals they have reached. *Agents without a route* is a diagnostic counter: anything above zero means an agent was spawned off the mesh or cannot reach its target. This sample is useful for crowds of characters in games, for pedestrian and evacuation simulations, and for any scene where many units or vehicles share the same space. The following parameters can be adjusted at run time: - **Scenario** - the situation the crowd is put in - **Agents** and **Circle radius** - the number of agents and the size of the circle. Both take effect only on restart, since the agents are respawned - **Restart scenario** - respawns the whole crowd from scratch, applying the values that require a restart - **Teleport all to one point** - instantly moves every agent into a small area around one point, and the crowd spreads them back out - **Neighbor range** and **Max neighbors** - how far around itself and how many neighbors an agent takes into account. The range should be at least 2 * (max speed * prediction time + agent radius): a shorter one makes the agents notice each other too late to steer away, while a longer one costs performance for no gain - **Prediction time** - how far ahead (in seconds) an agent predicts the collisions. Low values make the crowd react at the last moment and collide, high values make the agents swerve early and take wider detours - **Desired velocity**, **Current velocity**, **Side preference**, **Time to impact**, and **Separation** - the weights balancing what the agent tries to do: follow its route, keep its current course, prefer one side when passing by, dodge imminent collisions, and keep its distance - **VIP agent** - gives the first agent of the crowd, marked with a yellow circle, a fixed high avoidance priority. Where two agents meet, the one with the lower priority does more of the dodging, so the crowd yields to the VIP. Every agent gets a random priority from 0 to 5 and a slightly randomized walk speed at spawn: unequal agents resolve the symmetric head-on encounters instead of deadlocking in front of each other - **Teams ignore each other** - gives each team its own interaction mask, so the agents avoid only their teammates and the two teams walk through each other. Shows how the interaction masks split a crowd into groups that do not collide - **Use obstacles** - the agents respect the body obstacles carried by the other agents: a standing group obstructs the walkable area and the routes are rebuilt around it. Each agent excludes its own obstacle from its route search, so it never blocks itself. With **Teams ignore each other** enabled only the obstacles of the own team are respected - **Show Seeker Debug** and **Show Navigation Mesh** - draw the route corridor and the velocities of every agent, and the navigation mesh itself - **Density heatmap** - colors the ground by the agent density the solver computes, from green to red. The heatmap makes the congestion visible: in **Bottleneck** the red spot marks the jam at the gates - **Density cell** - the cell size of the density grid: smaller cells give a more detailed heatmap The agents are spawned at runtime from the two team assets and driven by the reusable *ExperimentalSeekerCrowd* component: it registers the agents, gathers the velocities they want each frame, runs the *[ExperimentalNavigationAvoidance](../../../api/library/pathfinding/class.experimentalnavigationavoidance_cpp.md)* solver over them, and moves them with the adjusted velocities. The solver settings, per-agent priorities, and interaction masks are also set through this component. The spawn positions are validated against the mesh beforehand with *[findNearestPoint()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#findNearestPoint_ExperimentalNavigationMeshFilter_Vec3_Vec3_int)* plus a route fetch, so no agent starts off the mesh or behind a wall, and the wandering targets come from *[findRandomReachablePoint()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#findRandomReachablePoint_ExperimentalNavigationMeshFilter_Vec3_float_Vec3_llong_int)*. **SDK Path:***/data/csharp_component_samples/navigation/experimental_navigation_mesh_crowd* ## Experimental Navigation Mesh Demo This sample demonstrates several material balls collecting coins on a plane with obstacles, navigating around by means of an **[Experimental Navigation Mesh](../../../objects/navigations/experimental/navigation_mesh/index.md)**. Each ball looks for its own way to the coin and follows it, staying on the navigation mesh as it moves; once a coin is collected, the next one appears elsewhere. Every ball has its own tab, so they can be given different settings and compared while they move - the ball being edited is highlighted in the scene. This sample is useful for crowds and groups of units in games, and for simulations where many vehicles or machines move through the same space at once. The following parameters can be adjusted at run time: - **Movement speed** - how fast the ball moves - **Straight mode** - how detailed the resulting path is: only the corners it turns at, those corners plus the points where it moves between areas, or every polygon it crosses along the way - **Heuristic scale** - the search accuracy: 1 gives the shortest path, higher values find a path faster but not necessarily the best one - **Max cost** and **Max search nodes** - how long the search is allowed to run before it gives up - **Agent radius** and **Agent height** - how wide and tall the ball is, defining the gaps it can squeeze through - **Max slope angle** and **Max step height** - how steep a slope the ball can climb and how high a step it can get over - **Snap size** - how far off the navigation mesh the start and end points may be and still snap onto it - **Consider obstacles** - whether obstacles block the route or are ignored - **Show Seeker Debug** - draws the route and the velocities of the ball of the current tab - **Show Navigation Mesh** - draws the navigation mesh itself, shared by all the balls. Each ball is an *ExperimentalSeeker* component: it requests its route through *[ExperimentalNavigationPathFetch](../../../api/library/pathfinding/class.experimentalnavigationpathfetch_cpp.md)* and then follows it with *[ExperimentalNavigationMeshCorridor](../../../api/library/pathfinding/class.experimentalnavigationmeshcorridor_cpp.md)*, which keeps the ball on the walkable surface as it moves. The route is replanned when the coin is collected and appears elsewhere, or when the navigation mesh changes under the ball. **SDK Path:***/data/csharp_component_samples/navigation/experimental_navigation_mesh_demo* ## Experimental Navigation Mesh Queries This sample demonstrates the spatial queries an **[Experimental Navigation Mesh](../../../objects/navigations/experimental/navigation_mesh/index.md)** can answer about the walkable area, without building a full route. The central ball is the query point: drag it around the level and, depending on the selected mode, see the nearest walkable position, the places reachable from here within a given travel cost, where the walkable area ends, or the parts of the mesh that fall inside a box drawn around the point. Seven queries with adjustable parameters are available, switched with the **Query mode** selector. These queries are the building blocks behind common gameplay and simulation tasks: placing a unit on walkable ground, showing how far it can go in one turn, scattering spawn points over the level, and keeping an agent away from ledges. The *Status* block reports the state of the mesh (polygons, walkable area size, loaded tiles) and the numbers the current query returned. The available query modes: - **Nearest point** - snaps the query point onto the mesh with *[findNearestPoint()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#findNearestPoint_ExperimentalNavigationMeshFilter_Vec3_Vec3_int)*, drawing a line down to the walkable area, and reports the polygon it landed on via *[findNearestPolygon()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#findNearestPolygon_ExperimentalNavigationMeshFilter_Vec3_llong)*, with the area, its cost, and the flags of that polygon - **Reachable points** - uses *[findReachablePoints()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#findReachablePoints_ExperimentalNavigationMeshFilter_Vec3_float_VECVec3_VECllong_llong_int)* to sample the points reachable from the query point within the **Max cost** limit, drawn as a reference circle. The cost accumulates along the walkable area, so detours around obstacles exhaust it sooner and leave fewer points behind them - **Random reachable points** - calls *[findRandomReachablePoint()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#findRandomReachablePoint_ExperimentalNavigationMeshFilter_Vec3_float_Vec3_llong_int)* to scatter random points that can be reached from the query point within the **Max cost** limit - **Random points** - calls *[findRandomPoint()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#findRandomPoint_ExperimentalNavigationMeshFilter_Vec3_int)* to scatter random points over the whole mesh. Both random modes re-sample whenever the query point moves or a setting changes, or every half a second while **Auto refresh** is enabled. The status reports **Points requested** against **Points generated**: the second value is lower when the walkable area cannot fit them all - **Nearest boundary** - uses *[getNearestBoundary()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#getNearestBoundary_ExperimentalNavigationMeshFilter_Vec3_float_Vec3_vec3_float_llong_int)* to find the closest edge of the walkable area within the **Boundary radius** and draws a line from the query point to it. The edge point is marked in red, with a blue arrow along its normal, which points inwards, and the status reports the distance to it - **Boundary raycast** - traces a straight line from the query point to the second ball with *[getBoundaryIntersection()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#getBoundaryIntersection_ExperimentalNavigationMeshFilter_Vec3_Vec3_Vec3_vec3_llong_int)* and reports where it runs off the walkable area. The part of the line that stays on the mesh is white, the exit point is marked in red, and the part beyond the mesh is red as well - **Polygons in box** - uses *[getPolygons()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#getPolygons_ExperimentalNavigationMeshFilter_WorldBoundBox_VECllong_int)* to collect the mesh polygons inside the box drawn around the query point, sized by **Box size**. The triangles of those polygons are highlighted by the visualizer and counted separately in the **Status** section: a polygon is collected once the box overlaps it, while a triangle is highlighted only if its center is inside the box The **Show Navigation Mesh** toggle draws the mesh itself, colored by the areas of its polygons. Every query is wrapped into a self-contained *query_** function that depends only on the Engine API, so any of them can be copied into a project together with its result structure. The mesh geometry used to highlight the surface is fetched once via *[getTriangles()](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#getTriangles_VECVec3_VECint_VECint_void)* and re-fetched only when the *[EventTilesChanged](../../../api/library/pathfinding/class.experimentalnavigationmesh_cpp.md#EventTilesChanged)* event reports that the tiles have changed. **SDK Path:***/data/csharp_component_samples/navigation/experimental_navigation_mesh_queries* ## Experimental Navigation Mesh Terrain This sample demonstrates how to build a hierarchical navigation model on a large terrain, so the full detail is only kept around the agents, instead of being held in memory all at once. The world holds two **[Experimental Navigation Mesh](../../../objects/navigations/experimental/navigation_mesh/index.md)** nodes different in resolution: a coarse one, baked with a large cell size, covering the terrain entirely, and a detailed one with small cells whose tiles are continuously baked and streamed as the agents move. **Right-click** a place on the terrain to send the group of animated characters there. Each agent plans the whole route on the coarse mesh first, then splits it into legs and walks every leg on the detailed mesh. Both meshes are coloured depending on the area each polygon belongs to, which defines its traversal cost. Spawn and move obstacles on the agents' way to cut the walkable area out of both meshes, and see how the affected tiles are rebaked and the agents route around the obstruction. The *Status* block reports the state of both meshes and the route of the lead agent leg by leg, along with the failure reason when a route cannot be built. This sample is useful for open worlds and large simulation sites where the layout changes at runtime and a single navigation mesh cannot cover the needed detail. The coarse mesh stays in memory as a whole, so a route to any point of the terrain can be found at any time. The tiles of the detailed one are baked around the *[ExperimentalNavigationMeshInvoker](../../../api/library/pathfinding/class.experimentalnavigationmeshinvoker_cpp.md)* that each agent carries, within its *[load distance](../../../api/library/pathfinding/class.experimentalnavigationmeshinvoker_cpp.md#LoadDistance)*. The agents are driven by the reusable *ExperimentalSeeker* component, which plans the global route on the coarse mesh and then every leg of it on the detailed one. The route is split into legs automatically, according to the waypoint spacing set in the component in the Editor, so that every local route stays within the tiles baked around the agent. *ExperimentalSeekerCharacter* adds the locomotion animations, and an *ExperimentalSeekerCrowd* component on the logic node steers the agents around each other. The *Show Seeker Debug* toggle draws the route corridor and the global route waypoints of every agent. *Show Local Navigation Mesh* draws the detailed streamed mesh, making it visible how its tiles are baked and dropped around the moving agents, and *Show Global Navigation Mesh* draws the coarse resident mesh the global routes are planned on. Each obstacle asset carries an *[ExperimentalNavigationMeshAreaVolume](../../../api/library/pathfinding/class.experimentalnavigationmeshareavolume_cpp.md)* node that cuts the walkable area, and the Engine rebakes the tiles it touches. *Carve while dragging* sets when that happens: the walkable area either follows the obstacle as it moves, or is rebuilt *[once the obstacle is released and settles](../../../api/library/pathfinding/class.experimentalnavigationmeshareavolume_cpp.md#DynamicApplyOnlyWhenStationary)*. The *[ExperimentalNavigation](../../../api/library/pathfinding/class.experimentalnavigation_cpp.md)* singleton caps how much time is spent on streaming each frame, keeping the frame rate stable while the agents move. It also counts the *[navigation tasks](../../../api/library/pathfinding/class.experimentalnavigation_cpp.md#NumActiveTasks)* running right now and tells whether the tiles have hit the *[memory limit](../../../api/library/pathfinding/class.experimentalnavigation_cpp.md#IsStreamingMemoryLimitReached)* - both shown in the status. **SDK Path:***/data/csharp_component_samples/navigation/experimental_navigation_mesh_terrain* ## Navigation Mesh 2D This sample demonstrates how to calculate and visualize 2D navigation paths using the **[Navigation Mesh](../../../objects/navigations/navigation/navigation_mesh/index.md)** object and *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class via the C# API. It shows how to build a route between two points on a navigation mesh and renders the result for debugging or visualization purposes. This setup is useful for prototyping AI navigation, testing route validity, and analyzing the structure of navigable areas in 2D gameplay scenarios. The main logic is implemented in the **PathRoute2D** component, which initializes a *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class instance and uses *[PathRoute.Create2D()](../../../api/library/pathfinding/class.pathroute_cpp.md#create2D_Vec3_Vec3_int_void)* to compute the path from a start node to a finish node. If the route is successfully resolved, the path is drawn on screen using *[RenderVisualizer()](../../../api/library/pathfinding/class.pathroute_cpp.md#renderVisualizer_vec4_void)*. The radius parameter is set manually to ensure the generated path accounts for the navigation agent's size, avoiding collisions with nearby geometry. The sample includes a second component, **NavigationMeshVisualizer**, that renders the **Navigation Mesh** during runtime to help visualize navigable areas. **SDK Path:***/data/csharp_component_samples/navigation/navigation_mesh_2d* ## Navigation Mesh 2D Demo This sample demonstrates how to implement dynamic 2D pathfinding using a **[Navigation Mesh](../../../objects/navigations/navigation/navigation_mesh/index.md)** object, with autonomous robots navigating toward randomly positioned targets. Each robot uses a *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class instance to calculate a valid route within the navigation mesh and moves along it in real time. This setup is useful for prototyping simple AI behavior such as patrolling or target chasing, where agents continuously search for and move toward dynamic goals. The main logic is implemented in the **PathRoute2DWithTarget** component. On initialization, it creates a coin from a **[Node Reference](../../../objects/nodes/reference/index.md)** and places it at a random valid location inside the Navigation Mesh. A *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* instance is initialized with a defined agent radius to ensure the generated path accounts for the agent's size, avoiding collisions with nearby geometry. At runtime, the component continuously checks whether the robot is near its current target. If so, the target is moved to a new valid position, and a new path is generated using *[Create2D()](../../../api/library/pathfinding/class.pathroute_cpp.md#create2D_Vec3_Vec3_int_void)*. If the route is valid, the path is drawn on screen using *[RenderVisualizer()](../../../api/library/pathfinding/class.pathroute_cpp.md#renderVisualizer_vec4_void)* and the robot moves forward along it and smoothly adjusts its orientation using quaternion interpolation. The sample includes a second component, **NavigationMeshVisualizer**, that renders the actual mesh structure during runtime to help visualize navigable areas. **SDK Path:***/data/csharp_component_samples/navigation/navigation_mesh_2d_demo* ## Navigation Obstacles 2D This sample demonstrates how to use dynamic **[Obstacles](../../../objects/navigations/obstacle/index.md)** in combination with a **[Navigation Mesh](../../../objects/navigations/navigation/navigation_mesh/index.md)** to influence 2D pathfinding in runtime. When an obstacle overlaps the navigation mesh, it temporarily modifies the traversable area, forcing the pathfinding algorithm to recalculate a valid route around it. This example is useful for prototyping interactive environments, where navigation must adapt to moving objects, barriers, or other gameplay elements affecting traversal. The main logic is implemented in the **PathRoute2D** component, which initializes a *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class instance and uses *[PathRoute.Create2D()](../../../api/library/pathfinding/class.pathroute_cpp.md#create2D_Vec3_Vec3_int_void)* to compute the path from a start node to a finish node. If the route is successfully resolved, the path is drawn on screen using *[RenderVisualizer()](../../../api/library/pathfinding/class.pathroute_cpp.md#renderVisualizer_vec4_void)*. The radius parameter is set manually to ensure the generated path accounts for the navigation agent's size, avoiding collisions with nearby geometry. To demonstrate dynamic behavior, several **Obstacles** are moved using the **Rotator** component, which continuously rotates them during runtime. This setup allows you to observe how the path is recalculated when obstacles shift position and alter the available navigation space. **SDK Path:***/data/csharp_component_samples/navigation/navigation_obstacles_2d* ## Navigation Sectors 2D This sample demonstrates how to calculate and visualize 2D navigation paths using the **[Navigation Sector](../../../objects/navigations/navigation/navigation_sector/index.md)** objects and *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class. Unlike navigation meshes, sectors allow defining modular navigable areas that can be enabled, disabled, or moved dynamically at runtime. This 2D version is well-suited for top-down navigation, grid-based layouts, or layered 2D gameplay. For more complex 3D navigation scenarios, see the *Navigation Sectors 3D* sample. The main logic is implemented in the **PathRoute2D** component, which creates a *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class instance and uses *[Create2D()](../../../api/library/pathfinding/class.pathroute_cpp.md#create2D_Vec3_Vec3_int_void)* to compute a path through the active navigation sectors. If the route is successfully resolved, the path is drawn on screen using *[RenderVisualizer()](../../../api/library/pathfinding/class.pathroute_cpp.md#renderVisualizer_vec4_void)*. The radius parameter is set manually to ensure the generated path accounts for the agent's size, avoiding collisions with nearby geometry. To help visualize active navigation areas, the **NavigationSectorVisualizer** component renders the geometry of all sectors during runtime. Sectors are especially useful when navigation space needs to change at runtime - for example, if parts of the environment become inaccessible. Pathfinding requires sectors to be properly connected (their edges must overlap). **SDK Path:***/data/csharp_component_samples/navigation/navigation_sectors_2d* ## Navigation Sectors 3D This sample demonstrates how to calculate and visualize 3D navigation paths using the **[Navigation Sector](../../../objects/navigations/navigation/navigation_sector/index.md)** objects and *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class via the C# API. Unlike navigation meshes, sectors allow defining modular navigable areas that can be enabled, disabled, or moved dynamically at runtime. This setup is useful for multilevel structures or modular environments where the layout changes dynamically. For simpler 2D navigation scenarios, see the *Navigation Sectors 2D* sample. The main logic is implemented in the **PathRoute3D** component, which creates a *PathRoute* class instance and uses *[Create3D()](../../../api/library/pathfinding/class.pathroute_cpp.md#create3D_Vec3_Vec3_int_void)* to compute a path through the active navigation sectors. If the route is successfully resolved, the path is drawn on the screen using *[RenderVisualizer()](../../../api/library/pathfinding/class.pathroute_cpp.md#renderVisualizer_vec4_void)*. The radius parameter is set manually to ensure the generated path accounts for the agent's size, avoiding collisions with nearby geometry. To help visualize active navigation areas, the **NavigationSectorVisualizer** component renders the geometry of all sectors during runtime. Sectors are especially useful when navigation space needs to change at runtime - for example, if parts of the environment become inaccessible. Pathfinding requires sectors to be properly connected (their edges must overlap). **SDK Path:***/data/csharp_component_samples/navigation/navigation_sectors_3d* ## Navigation Sectors 3D Demo This sample demonstrates how to implement 3D pathfinding logic using **[Navigation Sector](../../../objects/navigations/navigation/navigation_sector/index.md)** and *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* class via the C# API. Robots autonomously fly and collect coins, which are dynamically placed at random locations within the navigation sector volume. The main logic is implemented in the **PathRoute3DWithTarget** component. A *[PathRoute](../../../api/library/pathfinding/class.pathroute_cpp.md)* object is created to calculate a valid 3D path from the robot's current position to the target using *[PathRoute.Create3D()](../../../api/library/pathfinding/class.pathroute_cpp.md#create3D_Vec3_Vec3_int_void)*. Once a valid path is generated, the robot rotates toward the next point in the path and moves forward. If the path becomes invalid - for example, if the target ends up in an unreachable area, then the system selects a new target location and recalculates the route. Target positions are chosen at random inside the volume of a *Navigation Sector*, using *[Inside3D()](../../../api/library/pathfinding/class.navigation_cpp.md#inside3D_Vec3_float_int)* for validation. The route is automatically updated as the robot approaches the target. If the route is successfully resolved, the path is drawn on screen using *[RenderVisualizer()](../../../api/library/pathfinding/class.pathroute_cpp.md#renderVisualizer_vec4_void)*. To help visualize active navigation areas, the **NavigationSectorVisualizer** component renders the geometry of all sectors during runtime. This setup is well-suited for implementing autonomous navigation in 3D volume, where both the moving objects and their targets can change position during runtime within a defined navigable area. **SDK Path:***/data/csharp_component_samples/navigation/navigation_sectors_3d_demo*