class NavMesh
(Niantic.Lightship.AR.NavigationMesh.NavMesh)
Overview
This class manages the data structures associated with a navigation mesh ("NavMesh"). It dynamically builds a 2d grid on the meshes detected in the environment for running navigation algorithms on. You are able to retrieve a number of properties of the "NavMesh" from it. There are also a number of methods to help you place and move NavMeshAgent s on the board.
class NavMesh {
public:
// properties
ModelSettings Settings;
float Area;
List<Surface> Surfaces;
// methods
void Destroy();
NavMesh(ModelSettings settings, bool visualise);
bool IsOnNavMesh(Vector3 position, float delta);
bool FindNearestFreePosition(
Vector3 sourcePosition,
float range,
out Vector3 nearestPosition
);
bool FindRandomPosition(out Vector3 randomPosition);
bool FindNearestFreePosition(
Vector3 sourcePosition,
out Vector3 nearestPosition
);
bool FindRandomPosition(
Vector3 sourcePosition,
float range,
out Vector3 randomPosition
);
bool CheckFit(Vector3 center, float size);
bool RayCast(Ray ray, out Vector3 hitPoint);
bool CalculatePath(
Vector3 fromPosition,
Vector3 toPosition,
AgentConfiguration agent,
out Path path
);
void Scan(Vector3 origin, float range);
void Clear();
void Prune(Vector3 keepNodesOrigin, float range);
};
Detailed Documentation
This class manages the data structures associated with a navigation mesh ("NavMesh"). It dynamically builds a 2d grid on the meshes detected in the environment for running navigation algorithms on. You are able to retrieve a number of properties of the "NavMesh" from it. There are also a number of methods to help you place and move NavMeshAgent s on the board.
Properties
Settings
ModelSettings Settings
The configuration of the NavMeshModel.
Area
float Area
The discovered free area in square meters.
Methods
NavMesh
NavMesh(ModelSettings settings, bool visualise)
Constructs a new NavMesh using the parameters given.
Parameters:
settings
- Settings to calibrate unoccupied area detection.
visualise
- Visualize the NavMesh in the scene.
Returns:
Returns the newly created NavMesh.
IsOnNavMesh
bool IsOnNavMesh(Vector3 position, float delta)
Checks if a particular 3d position is on the NavMesh (within a certain threshold).
Parameters:
position
- The 3d position to check for.
delta
- The threshold distance from the NavMesh to check against.
Returns:
true if the position provided is within delta meters of the NavMesh grid plane.
Clear
void Clear()
Removes all surfaces from the NavMesh.