A* Pathfinding Project
4.3.2
The A* Pathfinding Project for Unity 3D
|
Public Member Functions | |
void | ForceSetVelocity (Vector2 velocity) |
Set the current velocity of the agent. More... | |
void | SetCollisionNormal (Vector2 normal) |
Set the normal of a wall (or something else) the agent is currently colliding with. More... | |
void | SetTarget (Vector2 targetPoint, float desiredSpeed, float maxSpeed) |
Point towards which the agent should move. More... | |
Public Attributes | |
int | agentIndex |
float | CalculatedSpeed => simulator.outputData.speed[agentIndex] |
Vector2 | CalculatedTargetPoint => simulator.outputData.targetPoint[agentIndex] |
int | NeighbourCount => throw new NotImplementedException() |
List< ObstacleVertex > | NeighbourObstacles => throw new NotImplementedException() |
SimulatorBurst | simulator |
Properties | |
float | AgentTimeHorizon [get, set] |
RVOLayer | CollidesWith [get, set] |
bool | DebugDraw [get, set] |
float | ElevationCoordinate [get, set] |
float | FlowFollowingStrength [get, set] |
float | Height [get, set] |
RVOLayer | Layer [get, set] |
bool | Locked [get, set] |
int | MaxNeighbours [get, set] |
float | ObstacleTimeHorizon [get, set] |
Vector2 | Position [get, set] |
Action | PreCalculationCallback [set] |
float | Priority [get, set] |
float | Radius [get, set] |
![]() | |
float | AgentTimeHorizon [get, set] |
Max number of estimated seconds to look into the future for collisions with agents. More... | |
float | CalculatedSpeed [get] |
Optimal speed of the agent to avoid collisions. More... | |
Vector2 | CalculatedTargetPoint [get] |
Optimal point to move towards to avoid collisions. More... | |
RVOLayer | CollidesWith [get, set] |
Layer mask specifying which layers this agent will avoid. More... | |
bool | DebugDraw [get, set] |
Draw debug information. More... | |
float | ElevationCoordinate [get, set] |
Coordinate which separates characters in the height direction. More... | |
float | FlowFollowingStrength [get, set] |
Determines how strongly this agent just follows the flow instead of making other agents avoid it. More... | |
float | Height [get, set] |
Height of the agent in world units. More... | |
RVOLayer | Layer [get, set] |
Specifies the avoidance layer for this agent. More... | |
bool | Locked [get, set] |
Locked agents will be assumed not to move. More... | |
int | MaxNeighbours [get, set] |
Max number of agents to take into account. More... | |
int | NeighbourCount [get] |
Number of neighbours that the agent took into account during the last simulation step. More... | |
List< ObstacleVertex > | NeighbourObstacles [get] |
List of obstacle segments which were close to the agent during the last simulation step. More... | |
float | ObstacleTimeHorizon [get, set] |
Max number of estimated seconds to look into the future for collisions with obstacles. More... | |
Vector2 | Position [get, set] |
Position of the agent. More... | |
System.Action | PreCalculationCallback [set] |
Callback which will be called right before avoidance calculations are started. More... | |
float | Priority [get, set] |
How strongly other agents will avoid this agent. More... | |
float | Radius [get, set] |
Radius of the agent in world units. More... | |
void ForceSetVelocity | ( | Vector2 | velocity | ) |
Set the current velocity of the agent.
This will override the local avoidance input completely. It is useful if you have a player controlled character and want other agents to avoid it.
Calling this method will mark the agent as being externally controlled for 1 simulation step. Local avoidance calculations will be skipped for the next simulation step but will be resumed after that unless this method is called again.
Implements IAgent.
void SetCollisionNormal | ( | Vector2 | normal | ) |
Set the normal of a wall (or something else) the agent is currently colliding with.
This is used to make the RVO system aware of things like physics or an agent being clamped to the navmesh. The velocity of this agent that other agents observe will be modified so that there is no component into the wall. The agent will however not start to avoid the wall, for that you will need to add RVO obstacles.
This value will be cleared after the next simulation step, normally it should be set every frame when the collision is still happening.
Implements IAgent.
void SetTarget | ( | Vector2 | targetPoint, |
float | desiredSpeed, | ||
float | maxSpeed | ||
) |
Point towards which the agent should move.
Usually you set this once per frame. The agent will try move as close to the target point as possible. Will take effect at the next simulation step.
targetPoint | Target point in world space (XZ plane or XY plane depending on if the simulation is configured for 2D or 3D). Note that this is a Vector2, not a Vector3 since the system simulates everything internally in 2D. So if your agents move in the XZ plane you will have to supply it as a Vector2 with (x,z) coordinates. |
desiredSpeed | Desired speed of the agent. In world units per second. The agent will try to move with this speed if possible. |
maxSpeed | Max speed of the agent. In world units per second. If necessary (for example if another agent is on a collision trajectory towards this agent) the agent can move at this speed. Should be at least as high as desiredSpeed, but it is recommended to use a slightly higher value than desiredSpeed (for example desiredSpeed*1.2). |
Implements IAgent.
int agentIndex |
float CalculatedSpeed => simulator.outputData.speed[agentIndex] |
Vector2 CalculatedTargetPoint => simulator.outputData.targetPoint[agentIndex] |
int NeighbourCount => throw new NotImplementedException() |
List<ObstacleVertex> NeighbourObstacles => throw new NotImplementedException() |
SimulatorBurst simulator |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
set |
|
getset |
|
getset |