A* Pathfinding Project  4.1.0
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
IAstarAIMovement Interface Reference

Exposes more movement methods that are not available in all movement scripts. More...

Detailed Description

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.

See Also
Pathfinding.IAstarAI
Pathfinding.AIBase
Pathfinding.RichAI

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.
 

Member Function Documentation

Vector3 ClampToNavmesh ( Vector3  position,
out bool  positionChanged 
)

Clamps the agent's position to the navmesh.

Parameters
positionPosition of the agent.
positionChangedTrue if the agent's position had to be modified.
Returns
New position of the agent that has been clamped to the navmesh.
Note
This will not update the position of the agent's Transform component. It is assumed that the caller will do that later.
void Move ( Vector3  position,
Vector3  deltaPosition 
)

Move the agent.

Parameters
positionPosition of the agent.
deltaPositionDirection and distance to move the agent in world space.
void RotateTowards ( Vector3  direction,
float  maxDegrees 
)

Rotates towards the specified direction.

Parameters
directionDirection rotate towards.
maxDegreesMaximum 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.

Parameters
positionCurrent 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.


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