Inherits MonoBehaviour.
|
| static Path | FindPathImmediate (Vector3 from, Vector3 to, float radius) |
| |
| static void | GetAllAgentsInRange (Vector3 point, float range, IList< Agent > agents) |
| |
| static float | GetHeight (Vector3 point) |
| |
| static Vector3 | GetMeshPoint (Vector3 point, float radius) |
| |
| static Vector3 | GetMeshPoint (Vector3 point, float radius, out NavigationZone zone) |
| |
| static Agent | GetNearestAgent (Vector3 point) |
| |
| static Vector3 | GetSurfacePoint (Vector3 point) |
| |
| static NavigationZone | GetZone (Agent agent) |
| |
| static NavigationZone | GetZone (Vector3 point) |
| |
| static NavigationZone | GetZone (int index) |
| |
| static bool | QueryCollision (Vector3 point, float radius) |
| |
| static bool | QueryMovement (Vector3 from, Vector3 to, float radius) |
| |
| static bool | QueryVisibility (Vector3 from, Vector3 to) |
| |
The NavigationWorld is a singleton MonoBehaviour that manages all the active NavigationZones on the scene. Use this class static methods when there are more than one active NavigationZone on the scene.
◆ FindPathImmediate()
| static Path NavAI.NavigationWorld.FindPathImmediate |
( |
Vector3 |
from, |
|
|
Vector3 |
to, |
|
|
float |
radius |
|
) |
| |
|
static |
Finds the path from the start point to the goal point.
- Parameters
-
| from | Initial path world point. |
| to | Destination path world point. |
| radius | Path radius in meters. |
- Returns
- The path connecting the two points.
This process is not multi-threaded and may cause performance problems. Use of this meothd is not recommended.
The path will be available immediately after this method call. Be sure to check if the path found is not invalid.
◆ GetAllAgentsInRange()
| static void NavAI.NavigationWorld.GetAllAgentsInRange |
( |
Vector3 |
point, |
|
|
float |
range, |
|
|
IList< Agent > |
agents |
|
) |
| |
|
static |
Fills the list with all agents in range of the point.
- Parameters
-
| point | Point used for the query. |
| range | Query search range in meters. |
| agents | List to be filled with agents. |
Agent distances to the point are compared using the distance between the point and the agent collision radius.This means that agent size can affect the result.
◆ GetHeight()
| static float NavAI.NavigationWorld.GetHeight |
( |
Vector3 |
point | ) |
|
|
static |
Gets the surface height of the world point.
- Parameters
-
| point | The world point used for the query. |
- Returns
- The height of the nearest surface point. NaN if there is no surface point above or below the input point.
◆ GetMeshPoint() [1/2]
| static Vector3 NavAI.NavigationWorld.GetMeshPoint |
( |
Vector3 |
point, |
|
|
float |
radius |
|
) |
| |
|
static |
Gets the collision-free mesh point closest to the input point.
- Parameters
-
| point | The world point used for the query. |
| radius | The collision radius for the point in meters. |
- Returns
- The world collision-free mesh point (x, height, z). Returns (NaN, NaN, NaN) if no valid collision-free mesh point was found.
This method will search all active zones and will return the mesh point nearest to the input world point with a minimum radius distance of an obstacle.
◆ GetMeshPoint() [2/2]
| static Vector3 NavAI.NavigationWorld.GetMeshPoint |
( |
Vector3 |
point, |
|
|
float |
radius, |
|
|
out NavigationZone |
zone |
|
) |
| |
|
static |
Gets the collision-free mesh point closest to the input point.
- Parameters
-
| point | The world point used for the query. |
| radius | The collision radius for the point in meters. |
| zone | The zone containing the world point. |
- Returns
- The world collision-free mesh point (x, height, z). Returns (NaN, NaN, NaN) if no valid collision-free mesh point was found.
This method will search all active zones and will return the mesh point nearest to the input world point with a minimum radius distance of an obstacle.
◆ GetNearestAgent()
| static Agent NavAI.NavigationWorld.GetNearestAgent |
( |
Vector3 |
point | ) |
|
|
static |
Gets the nearest agent to the point.
- Parameters
-
| point | World point used for the query. |
- Returns
- The nearest agent of the point.
Agent distances to the point are compared using the distance between the point and the agent collision radius.This means that agent size can affect the result.
◆ GetSurfacePoint()
| static Vector3 NavAI.NavigationWorld.GetSurfacePoint |
( |
Vector3 |
point | ) |
|
|
static |
Gets the world surface point with (x, height, z) coordinates.
- Parameters
-
| point | The world point used for the query. |
- Returns
- The world surface point (x, height, z). Returns (NaN, NaN, NaN) if no surface was found for the point.
This method will search all active zones and will return the surface point nearest to the input world point.
◆ GetZone() [1/3]
Gets the zone containing the agent.
- Parameters
-
| agent | The agent used for the query. |
- Returns
- The zone containing the agent. Null if there is no zone containing the agent.
GetZone may return a different zone from Agent.Zone.
◆ GetZone() [2/3]
Gets the zone containing the world point.
- Parameters
-
| point | The point used for the query. |
- Returns
- The zone containg the point. Null if there is no zone containing the point.
◆ GetZone() [3/3]
Gets the zone with the given index.
- Parameters
-
| index | The index used for the query. |
- Returns
- The zone with the given index.
This method gets the zone stored in the world zones list at the given index. Directly accessing the zone should only be done when there is only one active zone on the scene. In such case, use GetZone(0) to get the only active zone on the scene. If there are two or more active zones on the scene, this method is not recommended for use.
◆ QueryCollision()
| static bool NavAI.NavigationWorld.QueryCollision |
( |
Vector3 |
point, |
|
|
float |
radius |
|
) |
| |
|
static |
Returns true if the point is colliding with an obstacle.
- Parameters
-
| point | The point used for the query. |
| radius | The collision radius used for the query in meters. |
- Returns
- True if the point is within radius distance of an obstacle.
This method only considers collisions with obstacles that are carved on the mesh and does not consider collisions with agents.
◆ QueryMovement()
| static bool NavAI.NavigationWorld.QueryMovement |
( |
Vector3 |
from, |
|
|
Vector3 |
to, |
|
|
float |
radius |
|
) |
| |
|
static |
Returns true if the movement between the two points can be done with the given radius without colliding with any obstacles.
- Parameters
-
| from | Initial query world point. |
| to | Destinatin query world point. |
| radius | Collision radius for the movement in meters. |
- Returns
- True if the movement between the two points is possible for the given radius.
This method is equivalent to CapsuleCast, but it considers the navmesh triangles instead of object colliders. Only obstacles that are carved on the triangulation are considered for this query.
◆ QueryVisibility()
| static bool NavAI.NavigationWorld.QueryVisibility |
( |
Vector3 |
from, |
|
|
Vector3 |
to |
|
) |
| |
|
static |
Returns true if the points are visible to one another.
- Parameters
-
| from | Initial query world point. |
| to | Destination query world point. |
- Returns
- True if the points are visible to one another.
This method is equivalent to Unity's Physics.Raycast, but it considers the navmesh triangles instead of object colliders. Only obstacles that are carved on the triangulation are considered for this query.
◆ Instance
Gets the active instance of the NavigationWorld.
If no instance is active, a new one will be created. When called from out-side the main thread, if there is no instance active, the return value will be null.
◆ MainThread
| Thread NavAI.NavigationWorld.MainThread |
|
staticgetset |
Gets the main thread assigned to NavAI.
Since Unity Editor can use a different thread for the Editor, this propriety may be inaccurate when called from the editor.
◆ WorldSettings
| Settings NavAI.NavigationWorld.WorldSettings |
|
staticget |
Gets the world settings file.
The world settings file is used for agents and obstacles that are not placed in a zone.
◆ ZoneCount
| int NavAI.NavigationWorld.ZoneCount |
|
staticget |
Gets the number of active zones on the scene.