Class RichAI Extends AIBase, IAstarAI

Public

Advanced AI for navmesh based graphs.

A* Pro Feature:

This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited.
The Pro version can be bought here

Public Methods

GetRemainingPath (buffer, stale)

Fills buffer with the remaining path.

Public
SearchPath ()

Recalculate the current path.

Public
Teleport (newPosition, clearPath=true)

Instantly move the agent to a new position.

Public

Public Variables

acceleration

Max acceleration of the agent.

Public
approachingPartEndpoint

True if approaching the last waypoint in the current part of the path.

Public
approachingPathEndpoint

True if approaching the last waypoint of all parts in the current path.

Public
endOfPath

End point of path the agent is currently following.

Public
endReachedDistance

Max distance to the endpoint to consider it reached.

Public
funnelSimplification

Use funnel simplification.

Public
hasPath

True if this agent currently has a path that it follows.

Public
onTraverseOffMeshLink

Called when the agent starts to traverse an off-mesh link.

pathPending

True if a path is currently being calculated.

Public
reachedDestination

True if the ai has reached the destination.

Public
reachedEndOfPath

True if the agent has reached the end of the current path.

Public
remainingDistance

Approximate remaining distance along the current path to the end of the path.

Public
repeatedlySearchPaths

Search for new paths repeatedly.

Public
rotationSpeed

Max rotation speed of the agent.

Public
slowWhenNotFacingTarget

Slow down when not facing the target direction.

Public
slowdownTime

How long before reaching the end of the path to start to slow down.

Public
steeringTarget

Point on the path which the agent is currently moving towards.

Public
traversingOffMeshLink
wallDist

Walls within this range will be used for avoidance.

Public
wallForce

Force to avoid walls with.

Public

Inherited Public Members

FinalizeMovement (nextPosition, nextRotation)

Moves the agent to a position.

Public
FindComponents ()

Looks for any attached components like RVOController and CharacterController etc.

Public
GetFeetPosition ()

Position of the base of the character.

Public
Move (deltaPosition)

Move the agent.

Public
MovementUpdate (deltaTime, nextPosition, nextRotation)

Calculate how the character wants to move during this frame.

Public
SetPath (path, updateDestinationFromPath=true)

Make the AI follow the specified path.

Public
ShapeGizmoColor
Public Static Readonly
SimulateRotationTowards (direction, maxDegrees)

Simulates rotating the agent towards the specified direction and returns the new rotation.

Public
autoRepath

Determines how the agent recalculates its path automatically.

Public
canMove

Enables or disables movement completely.

Public
desiredVelocity

Velocity that this agent wants to move with.

Public
destination

Position in the world that this agent should move to.

Public
enableRotation

If true, the AI will rotate to face the movement direction.

Public
gravity

Gravity to use.

Public
groundMask

Layer mask to use for ground placement.

Public
height

Height of the agent in world units.

Public
isStopped

Gets or sets if the agent should stop moving.

Public
maxSpeed

Max speed in world units per second.

Public
movementPlane

Plane which this agent is moving in.

Public
onSearchPath

Called when the agent recalculates its path.

Public
orientation

Determines which direction the agent moves in.

Public
position

Position of the agent.

Public
radius

Radius of the agent in world units.

Public
rotation

Rotation of the agent.

Public
updatePosition

Determines if the character's position should be coupled to the Transform's position.

Public
updateRotation

Determines if the character's rotation should be coupled to the Transform's rotation.

Public
velocity

Actual velocity that the agent is moving with.

Public

Private/Protected Members

ApplyGravity (deltaTime)

Accelerates the agent downwards.

Protected
Awake ()
Protected
CalculateDeltaToMoveThisFrame (position, distanceToEndOfPath, deltaTime)

Calculates how far to move during a single frame.

Protected
CalculatePathRequestEndpoints (start, end)

Outputs the start point and end point of the next automatic path request.

Protected
CalculateWallForce (position, elevation, directionToTarget)
Private
CancelCurrentPathRequest ()
Protected
ClampToNavmesh (position, positionChanged)

Constrains the character's position to lie on the navmesh.

Protected
ClearPath ()

Clears the current path of the agent.

Protected
FinalMovement (position3D, deltaTime, distanceToEndOfPath, slowdownFactor, nextPosition, nextRotation)
Private
FixedUpdate ()

Called every physics update.

Protected
GizmoColorPath
Protected Static Readonly
MovementUpdateInternal (deltaTime, nextPosition, nextRotation)

Called during either Update or FixedUpdate depending on if rigidbodies are used for movement or not.

Protected
NextPart ()

Declare that the AI has completely traversed the current part.

Protected
OnDisable ()

Called when the component is disabled.

Protected
OnDrawGizmos ()
Protected
OnDrawGizmosSelected ()
Protected
OnEnable ()

Called when the component is enabled.

Protected
OnPathComplete (newPath)

Called when a requested path has been calculated.

Protected
OnUpgradeSerializedData (version, unityThread)

Handle serialization backwards compatibility.

Protected
RaycastPosition (position, lastElevation)

Checks if the character is grounded and prevents ground penetration.

Protected
Reset ()

Handle serialization backwards compatibility.

Protected
SimulateRotationTowards (direction, maxDegrees)

Simulates rotating the agent towards the specified direction and returns the new rotation.

Protected
Start ()

Starts searching for paths.

Protected
TraverseFunnel (fn, deltaTime, nextPosition, nextRotation)
Private
TraverseOffMeshLinkFallback (link)

Fallback for traversing off-mesh links in case onTraverseOffMeshLink is not set.

Protected
TraverseSpecial (link)

Traverses an off-mesh link.

Protected
Update ()

Called every frame.

Protected
UpdateTarget (fn)
Protected
UpdateVelocity ()
Protected
UpgradeSerializedData (isUnityThread)
Protected
animCompatibility
Private
canMove

Enables or disables movement completely.

Private
canSearch

Enables or disables recalculating the path at regular intervals.

Private
controller

Cached CharacterController component.

Protected
delayUpdatePath
Protected
distanceToSteeringTarget

Distance to steeringTarget in the movement plane.

Protected
height

Height of the agent in world units.

Private
lastCorner
Protected
lastDeltaPosition

Amount which the character wants or tried to move with during the last frame.

Protected
lastDeltaTime

Delta time used for movement during the last frame.

Protected
maxSpeed

Max speed in world units per second.

Private
nextCorners
Protected Readonly
prevFrame

Last frame index when prevPosition1 was updated.

Protected
prevPosition1

Position of the character at the end of the last frame.

Protected
prevPosition2

Position of the character at the end of the frame before the last frame.

Protected
radius

Radius of the agent in world units.

Private
richPath

Holds the current path that this agent is following.

Protected Readonly
rigid

Cached Rigidbody component.

Protected
rigid2D

Cached Rigidbody component.

Protected
rvoController

Cached RVOController component.

Protected
seeker

Cached Seeker component.

Protected
shouldRecalculatePath

True if the path should be automatically recalculated as soon as possible.

Protected
shouldRecalculatePath
Protected
simulatedPosition

Position of the agent.

Protected
simulatedRotation

Rotation of the agent.

Protected
tr

Cached Transform component.

Protected
usingGravity

Indicates if gravity is used during this frame.

Protected
velocity2D

Current desired velocity of the agent (does not include local avoidance and physics).

Protected
verticalVelocity

Velocity due to gravity.

Protected
waitingForPathCalculation

Only when the previous path has been calculated should the script consider searching for a new path.

Protected
wallBuffer
Protected Readonly

Deprecated Members

ApproachingPartEndpoint
Public
ApproachingPathEndpoint
Public
DistanceToNextWaypoint
Public
NextWaypoint

Waypoint that the agent is moving towards.

Public
OnTargetReached ()

Called when the end of the path is reached.

Protected
PathPending

True if a path to the target is currently being calculated.

Public
TargetPoint

Current waypoint that the agent is moving towards.

Public
TargetReached

True if the end of the path has been reached.

Public
TraversingSpecial
Public
UpdatePath ()

Force recalculation of the current path.

Public
Velocity

Current velocity of the agent.

Public
anim

Anim for off-mesh links.

Public