A* Pathfinding Project
3.1.4
The A* Pathfinding Project for Unity 3D
|
CharacterController helper for use on navmeshes. More...
Public Member Functions | |
Node | ClampAlongNavmesh (Vector3 startPos, Node startNode, Vector3 endPos, out Vector3 clampedPos) |
Applies constrained movement from startPos to endPos. | |
Vector3 | ClampMove (Vector3 currentPosition, Vector3 direction) |
Clamps a movement vector to the navmesh. | |
Vector3 | ClampToNavmesh (Vector3 target) |
Vector3 | SimpleMove (Vector3 currentPosition, Vector3 direction) |
Performs a Simple Move. | |
void | Start () |
Small closed list used for the tiny breadth-first-search. | |
void | Teleport () |
Call when a move out of the navmesh has been made. | |
Public Attributes | |
float | forwardPlanning |
Factor applied to direction during SimpleMove. | |
Protected Attributes | |
CharacterController | controller |
Node | prevNode |
Vector3 | prevPos |
Private Member Functions | |
void | OnAstarAwake () |
void | OnDisable () |
void | OnRescan (AstarPath active) |
Called on graph rescanning, updates the current node. | |
Private Attributes | |
List< Node > | tmpClosed = new List<Node>(32) |
Small stack used for the tiny breadth-first-search. | |
Stack< Node > | tmpStack = new Stack<Node>(16) |
CharacterController helper for use on navmeshes.
This character controller helper will clamp the desired movement to the navmesh before moving.
This results in that this character will not move out from the navmesh by it's own force by more than very small distances.
It can be used as a regular CharacterController, but the only move command you can use currently is SimpleMove.
Applies constrained movement from startPos to endPos.
The result is stored in clampedPos. Returns the new current node
Vector3 ClampMove | ( | Vector3 | currentPosition, |
Vector3 | direction | ||
) |
Clamps a movement vector to the navmesh.
Vector3 SimpleMove | ( | Vector3 | currentPosition, |
Vector3 | direction | ||
) |
Performs a Simple Move.
Similar to CharacterController.SimpleMove, but this function will clamp the desired movement to the navmesh Requires a CharacterController to be attached to the GameObject.
void Teleport | ( | ) |
Call when a move out of the navmesh has been made.
For example if you have teleported your unit to a new location you need to call this function to update the current node.
float forwardPlanning |
Factor applied to direction during SimpleMove.
A small value decreases corner cutting, a high value makes it take edges further away into account