A* Pathfinding Project
3.1.4
The A* Pathfinding Project for Unity 3D
|
Handles collision checking for graphs. More...
Public Member Functions | |
bool | Check (Vector3 position) |
Returns if the position is obstructed. | |
Vector3 | CheckHeight (Vector3 position) |
Returns the position with the correct height. | |
Vector3 | CheckHeight (Vector3 position, out RaycastHit hit, out bool walkable) |
Returns the position with the correct height. | |
RaycastHit[] | CheckHeightAll (Vector3 position) |
Returns all hits when checking height for position. | |
void | DeSerializeSettings (AstarSerializer serializer) |
Called to deserialize the object. | |
void | Initialize (Matrix4x4 matrix, float scale) |
Sets up several variables using the specified matrix and scale. | |
Vector3 | Raycast (Vector3 origin, out RaycastHit hit, out bool walkable) |
Same as CheckHeight, except that the raycast will always start exactly at origin walkable will be set to false if nothing was hit. | |
void | SerializeSettings (AstarSerializer serializer) |
Called to serialize the object. Called to serialize the object. | |
Public Member Functions inherited from ISerializableObject | |
void | DeSerializeSettings (AstarSerializer serializer) |
Called to deserialize the object. | |
void | SerializeSettings (AstarSerializer serializer) |
Called to serialize the object. | |
Public Attributes | |
bool | collisionCheck = true |
Toggle collision check. | |
float | collisionOffset = 0 |
float | diameter = 1F |
Diameter of capsule or sphere when checking for collision. | |
float | fromHeight = 100 |
The height to check from when checking height. | |
float | height = 2F |
Height of capsule or length of ray when checking for collision. | |
bool | heightCheck = true |
Toggle height check. | |
LayerMask | heightMask = -1 |
Layer mask to use for height check. | |
LayerMask | mask |
Layer mask to use for collision check. | |
const float | RaycastErrorMargin = 0.005F |
Offset to apply after each raycast to make sure we don't hit the same point again in CheckHeightAll. | |
RayDirection | rayDirection = RayDirection.Both |
Direction of the ray when checking for collision. | |
bool | thickRaycast = false |
Toggles thick raycast. | |
float | thickRaycastDiameter = 1 |
Diameter of the thick raycast in nodes. | |
ColliderType | type = ColliderType.Capsule |
Collision shape to use. | |
bool | unwalkableWhenNoGround = true |
Make nodes unwalkable when no ground was found with the height raycast. | |
Vector3 | up |
Direction to use as UP. | |
Private Attributes | |
float | finalRadius |
diameter * scale * 0.5. | |
float | finalRaycastRadius |
thickRaycastDiameter * scale * 0.5. | |
Vector3 | upheight |
up * height. | |
Handles collision checking for graphs.
Mostly used by grid based graphs
bool Check | ( | Vector3 | position | ) |
Returns if the position is obstructed.
If collisionCheck is false, this will always return true.
Vector3 CheckHeight | ( | Vector3 | position | ) |
Returns the position with the correct height.
If heightCheck is false, this will return position.
Vector3 CheckHeight | ( | Vector3 | position, |
out RaycastHit | hit, | ||
out bool | walkable | ||
) |
Returns the position with the correct height.
If heightCheck is false, this will return position.
walkable will be set to false if nothing was hit. The ray will check a tiny bit further than to the grids base to avoid floating point errors when the ground is exactly at the base of the grid
RaycastHit [] CheckHeightAll | ( | Vector3 | position | ) |
Returns all hits when checking height for position.
void DeSerializeSettings | ( | AstarSerializer | serializer | ) |
Called to deserialize the object.
All variables and data which are to be loaded should be loaded using Pathfinding::AstarSerializer::GetValue
A default value can also be passed, in case the variable isn't contained in the data that will be returned instead
void Initialize | ( | Matrix4x4 | matrix, |
float | scale | ||
) |
Sets up several variables using the specified matrix and scale.
Vector3 Raycast | ( | Vector3 | origin, |
out RaycastHit | hit, | ||
out bool | walkable | ||
) |
Same as CheckHeight, except that the raycast will always start exactly at origin walkable will be set to false if nothing was hit.
The ray will check a tiny bit further than to the grids base to avoid floating point errors when the ground is exactly at the base of the grid
void SerializeSettings | ( | AstarSerializer | serializer | ) |
Called to serialize the object. Called to serialize the object.
All variables and data which are to be saved should be passed to the serialized using Pathfinding::AstarSerializer::AddValue
float diameter = 1F |
|
private |
|
private |
float height = 2F |
Height of capsule or length of ray when checking for collision.
If type is set to Sphere, this does not affect anything
bool heightCheck = true |
Toggle height check.
If false, the grid will be flat
LayerMask heightMask = -1 |
Layer mask to use for height check.
LayerMask mask |
Layer mask to use for collision check.
This should only contain layers of objects defined as obstacles
RayDirection rayDirection = RayDirection.Both |
Direction of the ray when checking for collision.
If type is not Ray, this does not affect anything
float thickRaycastDiameter = 1 |
Diameter of the thick raycast in nodes.
1 equals nodeSize
ColliderType type = ColliderType.Capsule |
Collision shape to use.
bool unwalkableWhenNoGround = true |
Make nodes unwalkable when no ground was found with the height raycast.
If height raycast is turned off, this doesn't affect anything.
Vector3 up |
Direction to use as UP.
|
private |