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

Radius path modifier for offsetting paths. More...

Detailed Description

Radius path modifier for offsetting paths.

The radius modifier will offset the path to create the effect of adjusting it to the characters radius. It gives good results on navmeshes which have not been offset with the character radius during scan. Especially useful when characters with different radiuses are used on the same navmesh. It is also useful when using rvo local avoidance with the RVONavmesh since the RVONavmesh assumes the navmesh has not been offset with the character radius.

This modifier assumes all paths are in the XZ plane (i.e Y axis is up).

It is recommended to use the Funnel Modifier on the path as well.

See Also
RVONavmesh
Modifiers

Also check out the howto page "Using Modifiers".

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
Since
Added in 3.2.6

Public Member Functions

override void Apply (Path p)
 Main Post-Processing function.
 
List< Vector3 > Apply (List< Vector3 > vs)
 Apply this modifier on a raw Vector3 list.
 
- Public Member Functions inherited from MonoModifier
void Awake ()
 Alerts the Seeker that this modifier exists.
 
virtual void OnDestroy ()
 
void OnDisable ()
 
void OnEnable ()
 
virtual void PreProcess (Path p)
 
- Public Member Functions inherited from IPathModifier
void Apply (Path p)
 
void PreProcess (Path p)
 

Public Attributes

float detail = 10
 Detail of generated circle segments.
 
float radius = 1f
 Radius of the circle segments generated.
 
- Public Attributes inherited from MonoModifier
Seeker seeker
 

Properties

override int Order [get]
 
- Properties inherited from MonoModifier
abstract int Order [get]
 Modifiers will be executed from lower order to higher order.
 
- Properties inherited from IPathModifier
int Order [get]
 

Private Types

enum  TangentType {
  OuterRight = 1 << 0, InnerRightLeft = 1 << 1, InnerLeftRight = 1 << 2, OuterLeft = 1 << 3,
  Outer = OuterRight | OuterLeft, Inner = InnerRightLeft | InnerLeftRight
}
 

Private Member Functions

bool CalculateCircleInner (Vector3 p1, Vector3 p2, float r1, float r2, out float a, out float sigma)
 Calculates inner tangents for a pair of circles.
 
bool CalculateCircleOuter (Vector3 p1, Vector3 p2, float r1, float r2, out float a, out float sigma)
 Calculates outer tangents for a pair of circles.
 
TangentType CalculateTangentType (Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4)
 
TangentType CalculateTangentTypeSimple (Vector3 p1, Vector3 p2, Vector3 p3)
 
void DrawCircleSegment (Vector3 p1, float rad, Color col, float start=0, float end=(float) Math.PI *2.0f)
 Draws a circle segment.
 

Private Attributes

float[] a1 = new float[10]
 
float[] a2 = new float[10]
 
bool[] dir = new bool[10]
 
float[] radi = new float[10]
 

Member Enumeration Documentation

enum TangentType
private
Enumerator:
OuterRight 
InnerRightLeft 
InnerLeftRight 
OuterLeft 
Outer 
Inner 

Member Function Documentation

override void Apply ( Path  p)
virtual

Main Post-Processing function.

Implements MonoModifier.

List<Vector3> Apply ( List< Vector3 >  vs)

Apply this modifier on a raw Vector3 list.

bool CalculateCircleInner ( Vector3  p1,
Vector3  p2,
float  r1,
float  r2,
out float  a,
out float  sigma 
)
private

Calculates inner tangents for a pair of circles.

Parameters
p1Position of first circle
p2Position of the second circle
r1Radius of the first circle
r2Radius of the second circle
aAngle from the line joining the centers of the circles to the inner tangents.
sigmaWorld angle from p1 to p2 (in XZ space)

Add a to sigma to get the first tangent angle, subtract a from sigma to get the second tangent angle.

Returns
True on success. False when the circles are overlapping.
bool CalculateCircleOuter ( Vector3  p1,
Vector3  p2,
float  r1,
float  r2,
out float  a,
out float  sigma 
)
private

Calculates outer tangents for a pair of circles.

Parameters
p1Position of first circle
p2Position of the second circle
r1Radius of the first circle
r2Radius of the second circle
aAngle from the line joining the centers of the circles to the inner tangents.
sigmaWorld angle from p1 to p2 (in XZ space)

Add a to sigma to get the first tangent angle, subtract a from sigma to get the second tangent angle.

Returns
True on success. False on failure (more specifically when |r1-r2| > |p1-p2| )
TangentType CalculateTangentType ( Vector3  p1,
Vector3  p2,
Vector3  p3,
Vector3  p4 
)
private
TangentType CalculateTangentTypeSimple ( Vector3  p1,
Vector3  p2,
Vector3  p3 
)
private
void DrawCircleSegment ( Vector3  p1,
float  rad,
Color  col,
float  start = 0,
float  end = (float)Math.PI*2.0f 
)
private

Draws a circle segment.

Member Data Documentation

float [] a1 = new float[10]
private
float [] a2 = new float[10]
private
float detail = 10

Detail of generated circle segments.

Measured as steps per full circle.

It is more performant to use a low value. For movement, using a high value will barely improve path quality.

bool [] dir = new bool[10]
private
float [] radi = new float[10]
private
float radius = 1f

Radius of the circle segments generated.

Usually similar to the character radius.

Property Documentation

override int Order
get

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