A* Pathfinding Project  4.2.6
The A* Pathfinding Project for Unity 3D
GraphUpdateShape Class Reference

Defines a shape for a Pathfinding.GraphUpdateObject. More...

Detailed Description

Defines a shape for a Pathfinding.GraphUpdateObject.

The shape consists of a number of points which it can either calculate the convex hull of or use as a polygon directly.

A shape is essentially a 2D shape however it can be rotated arbitrarily. When a matrix and a list of points is specified in the constructor the matrix decides what direction is the 'up' direction. When checking if a point is contained in the shape, the point will be projected down on a plane where the 'up' direction is the normal and then it will check if the shape contains the point.

See also
Pathfinding.GraphUpdateObject.shape

Public Member Functions

 GraphUpdateShape ()
 
 GraphUpdateShape (Vector3[] points, bool convex, Matrix4x4 matrix, float minimumHeight)
 Construct a shape. More...
 
bool Contains (GraphNode node)
 
bool Contains (Vector3 point)
 
Bounds GetBounds ()
 World space bounding box of this shape. More...
 

Static Public Member Functions

static Bounds GetBounds (Vector3[] points, Matrix4x4 matrix, float minimumHeight)
 

Public Attributes

float minimumHeight
 

Properties

bool convex [get, set]
 Sets if the convex hull of the points should be calculated. More...
 
Vector3 [] points [get, set]
 Gets or sets the points of the polygon in the shape. More...
 

Private Member Functions

void CalculateConvexHull ()
 

Static Private Member Functions

static Bounds GetBounds (Vector3[] points, Vector3 right, Vector3 up, Vector3 forward, Vector3 origin, float minimumHeight)
 

Private Attributes

bool _convex
 
Vector3 [] _convexPoints
 
Vector3 [] _points
 
Vector3 forward = Vector3.forward
 
Vector3 origin
 
Vector3 right = Vector3.right
 
Vector3 up = Vector3.up
 

Constructor & Destructor Documentation

◆ GraphUpdateShape() [1/2]

◆ GraphUpdateShape() [2/2]

GraphUpdateShape ( Vector3 []  points,
bool  convex,
Matrix4x4  matrix,
float  minimumHeight 
)

Construct a shape.

Parameters
pointsContour of the shape in local space with respect to the matrix (i.e the shape should be in the XZ plane, the Y coordinate will only affect the bounds)
convexIf true, the convex hull of the points will be calculated.
See also
convex
Parameters
matrixlocal to world space matrix for the points. The matrix determines the up direction of the shape.
minimumHeightIf the points would be in the XZ plane only, the shape would not have a height and then it might not include any points inside it (as testing for inclusion is done in 3D space when updating graphs). This ensures that the shape has at least the minimum height (in the up direction that the matrix specifies).

Member Function Documentation

◆ CalculateConvexHull()

void CalculateConvexHull ( )
private

◆ Contains() [1/2]

bool Contains ( GraphNode  node)

◆ Contains() [2/2]

bool Contains ( Vector3  point)

◆ GetBounds() [1/3]

Bounds GetBounds ( )

World space bounding box of this shape.

◆ GetBounds() [2/3]

static Bounds GetBounds ( Vector3 []  points,
Matrix4x4  matrix,
float  minimumHeight 
)
static

◆ GetBounds() [3/3]

static Bounds GetBounds ( Vector3 []  points,
Vector3  right,
Vector3  up,
Vector3  forward,
Vector3  origin,
float  minimumHeight 
)
staticprivate

Member Data Documentation

◆ _convex

bool _convex
private

◆ _convexPoints

Vector3 [] _convexPoints
private

◆ _points

Vector3 [] _points
private

◆ forward

Vector3 forward = Vector3.forward
private

◆ minimumHeight

float minimumHeight

◆ origin

Vector3 origin
private

◆ right

Vector3 right = Vector3.right
private

◆ up

Vector3 up = Vector3.up
private

Property Documentation

◆ convex

bool convex
getset

Sets if the convex hull of the points should be calculated.

Convex hulls are faster but non-convex hulls can be used to specify more complicated shapes.

◆ points

Vector3 [] points
getset

Gets or sets the points of the polygon in the shape.

These points should be specified in clockwise order. Will automatically calculate the convex hull if convex is set to true


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