NavMeshclass
Navigation Mesh - allowing AI to navigate a world
Methods19
Showing 19 methods
public static void BakeNavMesh()
void—public Sandbox.Navigation.NavMeshPath CalculatePath(Sandbox.Navigation.CalculatePathRequest request)
Computes a navigation path between the specified start and target positions on the navmesh. Uses the same pathfinding algorithm as `Sandbox.NavMeshAgent`, taking agent configuration into account if provided. The result is suitable for direct use with `Sandbox.NavMeshAgent.SetPath(Sandbox.Navigation.NavMeshPath)`. If a complete path cannot be found, the result may indicate an incomplete or failed path.
| Parameter | Type | Description |
|---|---|---|
| request | CalculatePathRequest | — |
public virtual sealed void Dispose()
void—public System.Threading.Tasks.Task`1<bool> Generate(Sandbox.PhysicsWorld world)
| Parameter | Type | Description |
|---|---|---|
| world | PhysicsWorld | — |
Task<bool>—public System.Threading.Tasks.Task GenerateTile(Sandbox.PhysicsWorld world, Vector3 worldPosition)
Generates or regenerates the navmesh tile at the given world position. This function is thread safe but can only be called from the main thread.
Note
While most of the generation happens in parallel, this function also requires some time on the main thread. If you need to update many tiles, consider spreading the updates accross multiple frames.
| Parameter | Type | Description |
|---|---|---|
| world | PhysicsWorld | — |
| worldPosition | Vector3 | — |
Task—public System.Threading.Tasks.Task GenerateTiles(Sandbox.PhysicsWorld world, BBox bounds)
Generates or regenerates the navmesh tiles overlapping with the given bounds. This function is thread safe but can only be called from the main thread.
Note
While most of the generation happens in parallel, this function also requires some time on the main thread. If you need to update many tiles, consider spreading the updates accross multiple frames.
| Parameter | Type | Description |
|---|---|---|
| world | PhysicsWorld | — |
| bounds | BBox | — |
Task—public System.Collections.Generic.List`1<Vector3> GetSimplePath(Vector3 from, Vector3 to)
Obsolete: Use CalculatePath instead
| Parameter | Type | Description |
|---|---|---|
| from | Vector3 | — |
| to | Vector3 | — |
public void RequestTileGeneration(Vector3 worldPosition)
Queues the navmesh tile at the given world position for incremental generation over subsequent frames. Fire-and-forget alternative to `Sandbox.Navigation.NavMesh.GenerateTile(Sandbox.PhysicsWorld,Vector3)`.
| Parameter | Type | Description |
|---|---|---|
| worldPosition | Vector3 | — |
void—public void RequestTilesGeneration(BBox bounds)
Queues all navmesh tiles overlapping with the given bounds for incremental generation over subsequent frames. Fire-and-forget alternative to `Sandbox.Navigation.NavMesh.GenerateTiles(Sandbox.PhysicsWorld,BBox)`.
| Parameter | Type | Description |
|---|---|---|
| bounds | BBox | — |
void—public void SetDirty()
Set the navgiation a dirty, so it will rebuild over the next few frames. If you need an immediate rebuild, call `Sandbox.Navigation.NavMesh.Generate(Sandbox.PhysicsWorld)` instead.
void—No results match this filter.
Properties16
Showing 16 properties
public float Sandbox.Navigation.NavMesh.AgentHeight { get; set; }
Height of the agent
float—public float Sandbox.Navigation.NavMesh.AgentMaxSlope { get; set; }
The maximum slope an agent can walk up (in degrees)
float—public float Sandbox.Navigation.NavMesh.AgentRadius { get; set; }
The radius of the agent. This will change how much gap is left on the edges of surfaces, so they don't clip into walls.
float—public float Sandbox.Navigation.NavMesh.AgentStepSize { get; set; }
The maximum height an agent can climb (step)
float—public BBox Sandbox.Navigation.NavMesh.Bounds { get; set; }
The bounds to generate the navmesh within. Won't take effect until regenerated or reloaded.
public bool Sandbox.Navigation.NavMesh.CustomBounds { get; set; }
By Default , the navmesh will calculate bounds based on the world geometry, but if you want to override that, you can set custom bounds here.
bool—public bool Sandbox.Navigation.NavMesh.DeferGeneration { get; set; }
Skip tile generation during scene load. Tiles can then be generated on demand via `Sandbox.Navigation.NavMesh.GenerateTile(Sandbox.PhysicsWorld,Vector3)`, `Sandbox.Navigation.NavMesh.RequestTileGeneration(Vector3)`, etc.
bool—public bool Sandbox.Navigation.NavMesh.DrawMesh { get; set; }
Draw the navigation mesh in the editor
bool—public bool Sandbox.Navigation.NavMesh.EditorAutoUpdate { get; set; }
Constantly update the navigation mesh in the editor
bool—public Sandbox.TagSet Sandbox.Navigation.NavMesh.ExcludedBodies { get; set; }
Don't include these bodies in the generation
public Sandbox.TagSet Sandbox.Navigation.NavMesh.IncludedBodies { get; set; }
If any, we'll only include bodies with this tag
public bool Sandbox.Navigation.NavMesh.IncludeKeyframedBodies { get; set; }
Should the generator include keyframed bodies
bool—public bool Sandbox.Navigation.NavMesh.IncludeStaticBodies { get; set; }
Should the generator include static bodies
bool—public bool Sandbox.Navigation.NavMesh.IsDirty { get; set; }
The navigation mesh is dirty and needs a complete rebuild
bool—public bool Sandbox.Navigation.NavMesh.IsEnabled { get; set; }
Determines wether the navigation mesh is enabled and should be generated
bool—public bool Sandbox.Navigation.NavMesh.IsGenerating { get; set; }
The navigation mesh is generating
bool—No results match this filter.