interface IGameboard (Niantic.ARDK.Extensions.Gameboard.IGameboard)
Overview
Holds information about unoccupied areas in the environment. Requires meshing to be enabled. Provides pathfinding and functions for environmental queries. More...
interface IGameboard { // properties float Area; ModelSettings Settings; // events event GameboardDestroyed(); event GameboardUpdated(); // methods bool CalculatePath( Vector3 fromPosition, Vector3 toPosition, AgentConfiguration agent, out Path path ); bool CheckFit(Vector3 center, float size); void Clear(); void Destroy(); bool FindNearestFreePosition( Vector3 sourcePosition, float range, out Vector3 nearestPosition ); bool FindNearestFreePosition( Vector3 sourcePosition, out Vector3 nearestPosition ); bool FindRandomPosition(out Vector3 randomPosition); bool FindRandomPosition( Vector3 sourcePosition, float range, out Vector3 randomPosition ); bool IsOnGameboard(Vector3 position, float delta); void Prune(Vector3 keepNodesOrigin, float range); bool RayCast(Ray ray, out Vector3 hitPoint); void Scan(Vector3 origin, float range); void SetVisualisationActive(bool active); }; // direct descendants class Gameboard;
Detailed Documentation
Holds information about unoccupied areas in the environment. Requires meshing to be enabled. Provides pathfinding and functions for environmental queries.
Properties
float Area
The discovered free area in square meters.
ModelSettings Settings
The configuration this Gameboard was created with.
Events
event GameboardDestroyed()
Alerts subscribers that the Gameboard has been destroyed.
event GameboardUpdated()
Alerts subscribers that the Gameboard has been updated.
Methods
bool CalculatePath( Vector3 fromPosition, Vector3 toPosition, AgentConfiguration agent, out Path path )
Calculates a walkable path between the two specified positions.
Parameters:
fromPosition |
Start position. |
toPosition |
Destination position |
agent |
The configuration of the agent is path is calculated for. |
path |
The calculated path |
Returns:
True if either a complete or partial path is found. False otherwise.
bool CheckFit(Vector3 center, float size)
Checks whether an area is free to occupy by a box with footprint size*size. Does not take the height into account.
Parameters:
center |
Origin of the area in world position. |
size |
Width/Length of the object's estimated footprint in meter. |
void Clear()
Removes all surfaces from the board.
void Destroy()
Destroys the Gameboard and triggers the GameboardDestroyed event.
bool FindNearestFreePosition( Vector3 sourcePosition, float range, out Vector3 nearestPosition )
Finds the nearest world position on the Gameboard to the specified source position within a specified range.
Parameters:
sourcePosition |
The origin of the search. |
range |
Defines the search window (size = 2 * range). |
nearestPosition |
The resulting nearest position, if any. |
Returns:
True, if a nearest point could be found.
bool FindNearestFreePosition( Vector3 sourcePosition, out Vector3 nearestPosition )
Finds the nearest world position on the Gameboard to the specified source position.
Parameters:
sourcePosition |
The origin of the search. |
nearestPosition |
The resulting nearest position, if any. |
Returns:
True, if a nearest point could be found.
bool FindRandomPosition(out Vector3 randomPosition)
Finds a random world position on the Gameboard.
Parameters:
randomPosition |
The resulting random position, if any. |
Returns:
True, if a point could be found.
bool FindRandomPosition( Vector3 sourcePosition, float range, out Vector3 randomPosition )
Finds a random world position on the Gameboard within a specified range.
Parameters:
sourcePosition |
The origin of the search. |
range |
Defines the search window (size = 2 * range). |
randomPosition |
The resulting random position, if any. |
Returns:
True, if a point could be found.
bool IsOnGameboard(Vector3 position, float delta)
Checks whether the specified (projected) world position is on the Gameboard surface.
Parameters:
position |
World coordinate for the query. |
delta |
Tolerance in y position still considered on the Gameboard surface |
Returns:
True, if the specified position is on the Gameboard.
void Prune(Vector3 keepNodesOrigin, float range)
Removes nodes outside the specified squared area of size range*range. Use this to prune Gameboard for performance.
Parameters:
keepNodesOrigin |
Defines an origin in world position from which nodes will be kept. |
range |
Range of the box area where nodes will be kept. |
bool RayCast(Ray ray, out Vector3 hitPoint)
Raycasts against the Gameboard.
Parameters:
ray |
Ray to perform this function with. |
hitPoint |
Hit point in world coordinates, if any. |
Returns:
True if the ray hit a point on any plane within the Gameboard.
void Scan(Vector3 origin, float range)
Searches for occupied and unoccupied areas in the environment and updates the Gameboard accordingly by adding and removing nodes. For this, rays are cast against the mesh from the scan origin downwards. Raycasts will not find free areas under obstacles like tables, etc.
Parameters:
origin |
Origin of the scan in world position. |
range |
Area covered by the scan is size range*range. |
void SetVisualisationActive(bool active)
Activates/Deactivates visualisation of Gameboard areas and agent paths.
Parameters:
active |
Activates visualisation if true, deactivates if false |