Skip to main content

class LightshipNavMesh

(Niantic.Lightship.AR.NavigationMesh.LightshipNavMesh)

Overview

This class manages the data structures associated with a navigation mesh ("LightshipNavMesh"). 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 "LightshipNavMesh" from it. There are also a number of methods to help you place and move LightshipNavMeshAgent s on the board.

class LightshipNavMesh {
public:
// properties

ModelSettings Settings;
float Area;
List<Surface> Surfaces;

// methods

void Destroy();
LightshipNavMesh(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 ("LightshipNavMesh"). 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 "LightshipNavMesh" from it. There are also a number of methods to help you place and move LightshipNavMeshAgent s on the board.

Properties

Settings

ModelSettings Settings

The configuration of the NavMeshModel.

Area

float Area

The discovered free area in square meters.

Methods

LightshipNavMesh

LightshipNavMesh(ModelSettings settings, bool visualise)

Constructs a new LightshipNavMesh using the parameters given.

    Parameters:

    settings - Settings to calibrate unoccupied area detection.

    visualise - Visualize the LightshipNavMesh in the scene.

    Returns:

    Returns the newly created LightshipNavMesh.

IsOnNavMesh

bool IsOnNavMesh(Vector3 position, float delta)

Checks if a particular 3d position is on the LightshipNavMesh (within a certain threshold).

    Parameters:

    position - The 3d position to check for.

    delta - The threshold distance from the LightshipNavMesh to check against.

    Returns:

    true if the position provided is within delta meters of the LightshipNavMesh grid plane.

Clear

void Clear()

Removes all surfaces from the LightshipNavMesh.