Class LocalSpaceRichAI Extends RichAI
RichAI for local space (pathfinding on moving graphs).
What this script does is that it fakes graph movement. It can be seen in the example scene called 'Moving' where a character is pathfinding on top of a moving ship. The graph does not actually move in that example instead there is some 'cheating' going on.
When requesting a path, we first transform the start and end positions of the path request into local space for the object we are moving on (e.g the ship in the example scene), then when we get the path back, they will still be in these local coordinates. When following the path, we will every frame transform the coordinates of the waypoints in the path to global coordinates so that we can follow them.
At the start of the game (when the graph is scanned) the object we are moving on should be at a valid position on the graph and you should attach the Pathfinding.LocalSpaceGraph component to it. The Pathfinding.LocalSpaceGraph component will store the position and orientation of the object right there are the start and then we can use that information to transform coordinates back to that region of the graph as if the object had not moved at all.
This functionality is only implemented for the RichAI script, however it should not be hard to use the same approach for other movement scripts.
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 Variables
Root of the object we are moving on.
Inherited Public Members
Moves the agent to a position.
Looks for any attached components like RVOController and CharacterController etc.
Position of the base of the character.
Fills buffer with the remaining path.
Move the agent.
Calculate how the character wants to move during this frame.
Recalculate the current path.
Make the AI follow the specified path.
Simulates rotating the agent towards the specified direction and returns the new rotation.
Instantly move the agent to a new position.
Max acceleration of the agent.
True if approaching the last waypoint in the current part of the path.
True if approaching the last waypoint of all parts in the current path.
Determines how the agent recalculates its path automatically.
Enables or disables movement completely.
Velocity that this agent wants to move with.
Velocity that this agent wants to move with before taking local avoidance into account.
Position in the world that this agent should move to.
If true, the AI will rotate to face the movement direction.
End point of path the agent is currently following.
Distance to the end point to consider the end of path to be reached.
Use funnel simplification.
Gravity to use.
Layer mask to use for ground placement.
True if this agent currently has a path that it follows.
Height of the agent in world units.
Gets or sets if the agent should stop moving.
Max speed in world units per second.
Plane which this agent is moving in.
Called when the agent recalculates its path.
Called when the agent starts to traverse an off-mesh link.
Determines which direction the agent moves in.
True if a path is currently being calculated.
Position of the agent.
Prevent the velocity from being too far away from the forward direction of the character.
Radius of the agent in world units.
True if the ai has reached the destination.
True if the agent has reached the end of the current path.
Approximate remaining distance along the current path to the end of the path.
Rotation of the agent.
Max rotation speed of the agent.
Controls if the agent slows down to a stop if the area around the destination is crowded.
Slow down when not facing the target direction.
How long before reaching the end of the path to start to slow down.
Point on the path which the agent is currently moving towards.
Determines if the character's position should be coupled to the Transform's position.
Determines if the character's rotation should be coupled to the Transform's rotation.
Actual velocity that the agent is moving with.
Walls within this range will be used for avoidance.
Force to avoid walls with.
Private/Protected Members
Accelerates the agent downwards.
Calculates how far to move during a single frame.
Outputs the start point and end point of the next automatic path request.
Constrains the character's position to lie on the navmesh.
Clears the current path of the agent.
Called during either Update or FixedUpdate depending on if rigidbodies are used for movement or not.
Declare that the AI has completely traversed the current part.
Called when the component is disabled.
Called when the component is enabled.
Called when a requested path has been calculated.
Called every frame.
Handle serialization backwards compatibility.
Checks if the character is grounded and prevents ground penetration.
Handle serialization backwards compatibility.
Simulates rotating the agent towards the specified direction and returns the new rotation.
Starts searching for paths.
Fallback for traversing off-mesh links in case onTraverseOffMeshLink is not set.
Traverses an off-mesh link.
Cached CharacterController component.
Amount which the character wants or tried to move with during the last frame.
Delta time used for movement during the last frame.
Hit info from the last raycast done for ground placement.
Time when the last path request was started.
Position of the character at the end of the last frame.
Position of the character at the end of the frame before the last frame.
Holds the current path that this agent is following.
Cached Rigidbody component.
Cached Rigidbody component.
Cached RVOController component.
True if the path should be automatically recalculated as soon as possible.
Position of the agent.
Rotation of the agent.
True if the Start method has been executed.
Cached Transform component.
Indicates if gravity is used during this frame.
Current desired velocity of the agent (does not include local avoidance and physics).
Velocity due to gravity.
Only when the previous path has been calculated should the script consider searching for a new path.