PathBerserker2d  1.0
Platformer pathfinding solution
Static Public Member Functions | List of all members
PathBerserker2d.PBWorld Class Reference

Singleton managing the global NavGraph instance. More...

Inheritance diagram for PathBerserker2d.PBWorld:

Static Public Member Functions

static bool TryMapPoint (Vector2 position, out NavSegmentPositionPointer pointer)
 Tries to map a point to a navigation position. The distance a point can be away from the nearest segment is specified by PathBerserker2dSettings.PointMappingDistance More...
 
static bool TryMapPoint (Vector2 position, NavSegmentPositionPointer pointer, out NavSegmentPositionPointer result)
 Tries to map a point to a navigation position. Like TryMapPoint, but uses passed in pointer to speed up search. More efficient, if you want to track a mapped position over time. More...
 
static Vector2 GetRandomPointOnGraph ()
 
Returns
Random point on NavGraph. Might not be reachable.

 
static void PathTo (PathRequest pathRequest)
 Enqueues a PathRequest . The path will be solved async. Use the PathRequest object to check its status. More...
 
static List< NavSubsegmentPointerBoxCast (Rect rect, float rotation, float filterFromAngle, float filterToAngle)
 Get all segments intersecting a rotated box. Segments can additionally be filtered by angle. More...
 
static bool TryFindClosestPointTo (Vector2 position, NavAgent segmentFilter, out NavSegmentPositionPointer pointer)
 Similar to TryMapPoint, except it searches in a larger radius. (Distance controlled by PathBerserker2dSettings.ClosestToSegmentMaxDistance) This makes this function performance heavy. More...
 

Detailed Description

Singleton managing the global NavGraph instance.

Is instantiated automatically on scene load.

Use it to access the NavGraph, which is the graph the pathfinder works on.

Member Function Documentation

◆ BoxCast()

static List<NavSubsegmentPointer> PathBerserker2d.PBWorld.BoxCast ( Rect  rect,
float  rotation,
float  filterFromAngle,
float  filterToAngle 
)
static

Get all segments intersecting a rotated box. Segments can additionally be filtered by angle.

Parameters
rectIntersection rect.
rotationThe rotation of the rect around its center.
filterFromAngleMinium angle in degree of returned segments.
filterToAngleMaximum angle in degree of returned segments.

◆ PathTo()

static void PathBerserker2d.PBWorld.PathTo ( PathRequest  pathRequest)
static

Enqueues a PathRequest . The path will be solved async. Use the PathRequest object to check its status.

Returns
PathRequest object representing the pathfinding job.

◆ TryFindClosestPointTo()

static bool PathBerserker2d.PBWorld.TryFindClosestPointTo ( Vector2  position,
NavAgent  segmentFilter,
out NavSegmentPositionPointer  pointer 
)
static

Similar to TryMapPoint, except it searches in a larger radius. (Distance controlled by PathBerserker2dSettings.ClosestToSegmentMaxDistance) This makes this function performance heavy.

Parameters
positionPosition to map
segmentFilterFilters possible mappings. Use it to ensure an agent could be at the mapped point.
pointerMapped pointer
Returns
True, if successfully mapped.

◆ TryMapPoint() [1/2]

static bool PathBerserker2d.PBWorld.TryMapPoint ( Vector2  position,
NavSegmentPositionPointer  pointer,
out NavSegmentPositionPointer  result 
)
static

Tries to map a point to a navigation position. Like TryMapPoint, but uses passed in pointer to speed up search. More efficient, if you want to track a mapped position over time.

Parameters
positionPosition to map
pointerPointer with the previously mapped position. Taken as start for search.
Returns
True, if mapping succeeded

◆ TryMapPoint() [2/2]

static bool PathBerserker2d.PBWorld.TryMapPoint ( Vector2  position,
out NavSegmentPositionPointer  pointer 
)
static

Tries to map a point to a navigation position. The distance a point can be away from the nearest segment is specified by PathBerserker2dSettings.PointMappingDistance

Parameters
positionPosition to map
pointerPointer to mapped position or an invalid pointer, if mapping failed.
Returns
True, if mapping succeeded

The documentation for this class was generated from the following file: