Velocity Obstacle.
More...
Velocity Obstacle.
This is a struct to avoid too many allocations.
- See also
- https://en.wikipedia.org/wiki/Velocity_obstacle
|
| VO (Vector2 center, Vector2 offset, float radius, float inverseDt, float inverseDeltaTime) |
| Creates a VO for avoiding another agent. More...
|
|
Vector2 | Gradient (Vector2 p, out float weight) |
| Gradient and value of the cost function of this VO. More...
|
|
Vector2 | ScaledGradient (Vector2 p, out float weight) |
| Gradient and value of the cost function of this VO. More...
|
|
◆ VO()
VO |
( |
Vector2 |
center, |
|
|
Vector2 |
offset, |
|
|
float |
radius, |
|
|
float |
inverseDt, |
|
|
float |
inverseDeltaTime |
|
) |
| |
Creates a VO for avoiding another agent.
- Parameters
-
center | The position of the other agent relative to this agent. |
offset | Offset of the velocity obstacle. For example to account for the agents' relative velocities. |
radius | Combined radius of the two agents (radius1 + radius2). |
inverseDt | 1 divided by the local avoidance time horizon (e.g avoid agents that we will hit within the next 2 seconds). |
inverseDeltaTime | 1 divided by the time step length. |
◆ Gradient()
Vector2 Gradient |
( |
Vector2 |
p, |
|
|
out float |
weight |
|
) |
| |
Gradient and value of the cost function of this VO.
The VO has a cost function which is 0 outside the VO and increases inside it as the point moves further into the VO.
This is the negative gradient of that function as well as its value (the weight). The negative gradient points in the direction where the function decreases the fastest.
The value of the function is the distance to the closest edge of the VO and the gradient is normalized.
◆ ScaledGradient()
Vector2 ScaledGradient |
( |
Vector2 |
p, |
|
|
out float |
weight |
|
) |
| |
Gradient and value of the cost function of this VO.
Very similar to the Gradient method however the gradient and value have been scaled and tweaked slightly.
◆ SegmentObstacle()
static VO SegmentObstacle |
( |
Vector2 |
segmentStart, |
|
|
Vector2 |
segmentEnd, |
|
|
Vector2 |
offset, |
|
|
float |
radius, |
|
|
float |
inverseDt, |
|
|
float |
inverseDeltaTime |
|
) |
| |
|
static |
Creates a VO for avoiding another agent.
Note that the segment is directed, the agent will want to be on the left side of the segment.
◆ SignedDistanceFromLine()
static float SignedDistanceFromLine |
( |
Vector2 |
a, |
|
|
Vector2 |
dir, |
|
|
Vector2 |
p |
|
) |
| |
|
static |
Returns a negative number of if p lies on the left side of a line which with one point in a and has a tangent in the direction of dir.
The number can be seen as the double signed area of the triangle {a, a+dir, p} multiplied by the length of dir. If dir.magnitude=1 this is also the distance from p to the line {a, a+dir}.
◆ circleCenter
◆ colliding
◆ cutoffDir
◆ cutoffLine
◆ dir1
◆ dir2
◆ line1
◆ line2
◆ radius
◆ segment
◆ segmentEnd
◆ segmentStart
◆ weightBonus
◆ weightFactor
The documentation for this struct was generated from the following file:
- /Users/arong/Unity/a-pathfinding-project/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs