A* Pathfinding Project  3.6.1
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
LocalSpaceRichAI Class Reference

RichAI for local space (pathfinding on moving graphs). More...

Detailed Description

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 Update transform the coordinates of the waypoints in the path to global coordaintes so that we can follow them. This assumes that the object that we are moving on was at the origin (0,0,0) when the graph was scanned, otherwise it will not have the correct alignment.

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 Member Functions

override void UpdatePath ()
 Force recalculation of the current path.
 
- Public Member Functions inherited from RichAI
void OnDisable ()
 
void OnDrawGizmos ()
 

Public Attributes

LocalSpaceGraph graph
 Root of the object we are moving on.
 
- Public Attributes inherited from RichAI
float acceleration = 5
 Max acceleration of the agent.
 
Animation anim
 
float centerOffset = 1
 
bool drawGizmos = true
 Draw gizmos in the scene view.
 
float endReachedDistance = 0.01f
 Max distance to the endpoint to consider it reached.
 
RichFunnel.FunnelSimplification funnelSimplification = RichFunnel.FunnelSimplification.None
 Mode for funnel simplification.
 
Vector3 gravity = new Vector3(0,-9.82f,0)
 Gravity to use in case no character controller is attached.
 
LayerMask groundMask = -1
 Layer mask to use for ground placement.
 
float maxSpeed = 1
 Max speed of the agent.
 
bool preciseSlowdown = true
 Use a 3rd degree equation for calculating slowdown acceleration instead of a 2nd degree.
 
bool raycastingForGroundPlacement = true
 Raycast for ground placement (when not having a CharacterController).
 
float repathRate = 0.5f
 Delay (seconds) between path searches.
 
bool repeatedlySearchPaths = false
 Search for new paths repeatedly.
 
float rotationSpeed = 360
 Max rotation speed of the agent.
 
float slowdownTime = 0.5f
 How much time to use for slowdown in the end of the path.
 
bool slowWhenNotFacingTarget = true
 Slow down when not facing the target direction.
 
Transform target
 
float wallDist = 1
 Walls within this range will be used for avoidance.
 
float wallForce = 3
 Force to avoid walls with.
 

Protected Member Functions

override Vector3 UpdateTarget (RichFunnel fn)
 
- Protected Member Functions inherited from RichAI
virtual void OnEnable ()
 Run at start and when reenabled.
 
virtual void OnTargetReached ()
 Called when the end of the path is reached.
 
virtual void Start ()
 Starts searching for paths.
 
virtual void Update ()
 Update is called once per frame.
 

Additional Inherited Members

- Static Public Attributes inherited from RichAI
static readonly Color GizmoColorPath = new Color(8.0f/255,78.0f/255,194.0f/255)
 
static readonly Color GizmoColorRaycast = new Color(118.0f/255,206.0f/255,112.0f/255)
 
- Protected Attributes inherited from RichAI
List< Vector3 > buffer = new List<Vector3>()
 
bool canSearchPath = false
 
bool delayUpdatePath = false
 
bool lastCorner = false
 
float lastRepath = -9999
 
RichPath rp
 
Seeker seeker
 
Transform tr
 
bool traversingSpecialPath = false
 
bool waitingForPathCalc = false
 
List< Vector3 > wallBuffer = new List<Vector3>()
 
- Properties inherited from RichAI
bool ApproachingPartEndpoint [get]
 True if approaching the last waypoint in the current path.
 
bool ApproachingPathEndpoint [get]
 True if approaching the last waypoint of all parts in the current path.
 
float DistanceToNextWaypoint [get]
 Distance to the next waypoint.
 
Vector3 TargetPoint [get]
 Current target point.
 
bool TraversingSpecial [get]
 
Vector3 Velocity [get]
 Current velocity of the agent.
 

Member Function Documentation

override void UpdatePath ( )
virtual

Force recalculation of the current path.

If there is an ongoing path calculation, it will be canceled (so make sure you leave time for the paths to get calculated before calling this function again).

Reimplemented from RichAI.

override Vector3 UpdateTarget ( RichFunnel  fn)
protectedvirtual

Reimplemented from RichAI.

Member Data Documentation

Root of the object we are moving on.


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