A* Pathfinding Project
4.1.1
The A* Pathfinding Project for Unity 3D
|
Exposes more movement methods that are not available in all movement scripts. More...
Exposes more movement methods that are not available in all movement scripts.
The methods are hidden behind an interface primarily to avoid confusion and make the docs easier to read as these methods are very rarely needed.
Public Member Functions | |
Vector3 | ClampToNavmesh (Vector3 position, out bool positionChanged) |
Clamps the agent's position to the navmesh. | |
void | Move (Vector3 position, Vector3 deltaPosition) |
Move the agent. | |
void | RotateTowards (Vector3 direction, float maxDegrees) |
Rotates towards the specified direction. | |
void | UpdateVelocity (Vector3 position) |
To be called after all movement is done with the position of the agent. | |
Public Member Functions inherited from IAstarAI | |
void | MovementUpdate (float deltaTime, bool useGravity) |
Calculate all movement for a single movement step and move the agent. | |
void | SearchPath () |
Recalculate the current path. | |
void | Teleport (Vector3 newPosition, bool clearPath=true) |
Instantly move the agent to a new position. | |
Additional Inherited Members | |
Properties inherited from IAstarAI | |
bool | canMove [get, set] |
Enables or disables movement completely. | |
bool | canSearch [get, set] |
Enables or disables recalculating the path at regular intervals. | |
Vector3 | desiredVelocity [get] |
Velocity that this agent wants to move with. | |
Vector3 | destination [get, set] |
Position in the world that this agent should move to. | |
bool | hasPath [get] |
True if this agent currently has a path that it follows. | |
bool | isStopped [get, set] |
Gets or sets if the agent should stop moving. | |
float | maxSpeed [get, set] |
Max speed in world units per second. | |
System.Action | onSearchPath [get, set] |
Called when the agent recalculates its path. | |
bool | pathPending [get] |
True if a path is currently being calculated. | |
Vector3 | position [get] |
Position of the agent. | |
float | remainingDistance [get] |
Remaining distance along the current path to the destination. | |
Vector3 | steeringTarget [get] |
Point on the path which the agent is currently moving towards. | |
bool | targetReached [get] |
True if the agent has reached the end of the current path. | |
Vector3 | velocity [get] |
Actual velocity that the agent is moving with. | |
Vector3 ClampToNavmesh | ( | Vector3 | position, |
out bool | positionChanged | ||
) |
Clamps the agent's position to the navmesh.
position | Position of the agent. |
positionChanged | True if the agent's position had to be modified. |
void Move | ( | Vector3 | position, |
Vector3 | deltaPosition | ||
) |
Move the agent.
position | Position of the agent. |
deltaPosition | Direction and distance to move the agent in world space. |
void RotateTowards | ( | Vector3 | direction, |
float | maxDegrees | ||
) |
Rotates towards the specified direction.
direction | Direction rotate towards. |
maxDegrees | Maximum number of degrees to rotate this frame. |
void UpdateVelocity | ( | Vector3 | position | ) |
To be called after all movement is done with the position of the agent.
position | Current position of the agent (as a parameter mostly for performance reasons as reading from transform.position can be slow). |
You have to call this if you are handling movement manually to make sure e.g the velocity field is up to date.
This is automatically called by the Move method, so if you are using that method this should not be called.