A* Pathfinding Project
4.0.3
The A* Pathfinding Project for Unity 3D
|
Defines a shape for a Pathfinding.GraphUpdateObject. More...
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.
Public Member Functions | |
GraphUpdateShape () | |
GraphUpdateShape (Vector3[] points, bool convex, Matrix4x4 matrix, float minimumHeight) | |
Construct a shape. | |
bool | Contains (GraphNode node) |
bool | Contains (Vector3 point) |
Bounds | GetBounds () |
World space bounding box of this shape. | |
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. | |
Vector3[] | points [get, set] |
Gets or sets the points of the polygon in the shape. | |
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 |
GraphUpdateShape | ( | ) |
GraphUpdateShape | ( | Vector3[] | points, |
bool | convex, | ||
Matrix4x4 | matrix, | ||
float | minimumHeight | ||
) |
Construct a shape.
points | Contour 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) |
convex | If true, the convex hull of the points will be calculated. |
matrix | local to world space matrix for the points. The matrix determines the up direction of the shape. |
minimumHeight | If 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). |
|
private |
bool Contains | ( | GraphNode | node | ) |
bool Contains | ( | Vector3 | point | ) |
Bounds GetBounds | ( | ) |
World space bounding box of this shape.
|
static |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
float minimumHeight |
|
private |
|
private |
|
private |
|
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.
|
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