NavigationComponent Class
Namespace: Stride.NavigationAssembly: Stride.Navigation.dll
This is used to interface with the navigation mesh. Supports TryFindPath and Raycast
[DataContract("NavigationComponent")]
[Display("Navigation", null, Expand = ExpandRule.Once)]
[ComponentOrder(20000)]
[DefaultEntityComponentProcessor(typeof(NavigationProcessor), ExecutionMode = ExecutionMode.Runtime)]
[ComponentCategory("Navigation")]
public class NavigationComponent : EntityComponent, IIdentifiable
| Name | Description | |
|---|---|---|
| Properties | ||
| GroupId | The navigation mesh group to use |
|
| NavigationMesh | The navigation mesh which is being used. Setting this to |
|
| Methods | ||
| Raycast(Vector3) | Performs a raycast on the navigation mesh to perform line of sight or similar checks. Starts from the entity's current world position |
|
| Raycast(Vector3, Vector3) | Performs a raycast on the navigation mesh to perform line of sight or similar checks. |
|
| Raycast(Vector3, Vector3, NavigationQuerySettings) | Performs a raycast on the navigation mesh to perform line of sight or similar checks |
|
| Raycast(Vector3, NavigationQuerySettings) | Performs a raycast on the navigation mesh to perform line of sight or similar checks. Starts from the entity's current world position |
|
| TryFindPath(Vector3, Vector3, IList<Vector3>) | Finds a path from point to |
|
| TryFindPath(Vector3, Vector3, IList<Vector3>, NavigationQuerySettings) | Finds a path from point to |
|
| TryFindPath(Vector3, IList<Vector3>) | Finds a path from the entity's current location to |
|
| TryFindPath(Vector3, IList<Vector3>, NavigationQuerySettings) | Finds a path from the entity's current location to |
|
Properties
GroupId
The navigation mesh group to use
[DataMember(20)]
[Display("Group", null)]
public Guid GroupId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Guid |
NavigationMesh
The navigation mesh which is being used. Setting this to null will load the dynamic navigation mesh for the current game (if enabled)
[DataMember(10)]
public NavigationMesh NavigationMesh { get; set; }
Property Value
| Type | Description |
|---|---|
| NavigationMesh |
Methods
Raycast(Vector3)
Performs a raycast on the navigation mesh to perform line of sight or similar checks. Starts from the entity's current world position
public NavigationRaycastResult Raycast(Vector3 end)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | end | Ending point |
Returns
| Type | Description |
|---|---|
| NavigationRaycastResult | The found raycast hit if Hit is true |
Raycast(Vector3, Vector3)
Performs a raycast on the navigation mesh to perform line of sight or similar checks.
public NavigationRaycastResult Raycast(Vector3 start, Vector3 end)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | start | Starting point |
| Vector3 | end | Ending point |
Returns
| Type | Description |
|---|---|
| NavigationRaycastResult | The found raycast hit if Hit is true |
Raycast(Vector3, Vector3, NavigationQuerySettings)
Performs a raycast on the navigation mesh to perform line of sight or similar checks
public NavigationRaycastResult Raycast(Vector3 start, Vector3 end, NavigationQuerySettings querySettings)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | start | Starting point |
| Vector3 | end | Ending point |
| NavigationQuerySettings | querySettings | Advanced settings to be provided to the navigation mesh query |
Returns
| Type | Description |
|---|---|
| NavigationRaycastResult | The found raycast hit if Hit is true |
Raycast(Vector3, NavigationQuerySettings)
Performs a raycast on the navigation mesh to perform line of sight or similar checks. Starts from the entity's current world position
public NavigationRaycastResult Raycast(Vector3 end, NavigationQuerySettings querySettings)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | end | Ending point |
| NavigationQuerySettings | querySettings | Advanced settings to be provided to the navigation mesh query |
Returns
| Type | Description |
|---|---|
| NavigationRaycastResult | The found raycast hit if Hit is true |
TryFindPath(Vector3, Vector3, IList<Vector3>)
Finds a path from point to
public bool TryFindPath(Vector3 start, Vector3 end, IList<Vector3> path)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | start | The starting location of the pathfinding query |
| Vector3 | end | The ending location of the pathfinding query |
| System.Collections.Generic.IList<Vector3> | path | The resulting collection of waypoints for the found path, if any (at least 2 if a path was found) |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if a valid path was found |
TryFindPath(Vector3, Vector3, IList<Vector3>, NavigationQuerySettings)
Finds a path from point to
public bool TryFindPath(Vector3 start, Vector3 end, IList<Vector3> path, NavigationQuerySettings querySettings)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | start | The starting location of the pathfinding query |
| Vector3 | end | The ending location of the pathfinding query |
| System.Collections.Generic.IList<Vector3> | path | The resulting collection of waypoints for the found path, if any (at least 2 if a path was found) |
| NavigationQuerySettings | querySettings | Advanced settings to be provided to the navigation mesh query |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if a valid path was found |
TryFindPath(Vector3, IList<Vector3>)
Finds a path from the entity's current location to
public bool TryFindPath(Vector3 end, IList<Vector3> path)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | end | The ending location of the pathfinding query |
| System.Collections.Generic.IList<Vector3> | path | The resulting collection of waypoints for the found path, if any (at least 2 if a path was found) |
Returns
| Type | Description |
|---|---|
| System.Boolean | The found path points or null |
TryFindPath(Vector3, IList<Vector3>, NavigationQuerySettings)
Finds a path from the entity's current location to
public bool TryFindPath(Vector3 end, IList<Vector3> path, NavigationQuerySettings querySettings)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | end | The ending location of the pathfinding query |
| System.Collections.Generic.IList<Vector3> | path | The resulting collection of waypoints for the found path, if any (at least 2 if a path was found) |
| NavigationQuerySettings | querySettings | Advanced settings to be provided to the navigation mesh query |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if a valid path was found |