diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs index e7ae7e12..06ea01d0 100644 --- a/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs @@ -37,6 +37,10 @@ namespace Pathfinding.RVO.Sampled { #region IAgent Properties + public string AgentName {get; set;} + + public string IgnoredAgentName {get; set;} + /** \copydoc Pathfinding::RVO::IAgent::Position */ public Vector2 Position { get; set; } @@ -266,7 +270,7 @@ namespace Pathfinding.RVO.Sampled { */ internal float InsertAgentNeighbour (Agent agent, float rangeSq) { // Check if this agent collides with the other agent - if (this == agent || (agent.layer & collidesWith) == 0) return rangeSq; + if (this == agent || (agent.layer & collidesWith) == 0 || (this.IgnoredAgentName != "" && this.IgnoredAgentName == agent.AgentName)) return rangeSq; // 2D distance float dist = (agent.position - position).sqrMagnitude; diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs index 10446f4a..9747797e 100644 --- a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs @@ -21,6 +21,9 @@ namespace Pathfinding.RVO { * \astarpro */ public interface IAgent { + public string AgentName {get; set;} + public string IgnoredAgentName {get; set;} + /** Position of the agent. * The agent does not move by itself, a movement script has to be responsible for * reading the CalculatedTargetPoint and CalculatedSpeed properties and move towards that point with that speed. diff --git a/Assets/AstarPathfindingProject/RVO/RVOController.cs b/Assets/AstarPathfindingProject/RVO/RVOController.cs index f6f3e06a..32a3dcaa 100644 --- a/Assets/AstarPathfindingProject/RVO/RVOController.cs +++ b/Assets/AstarPathfindingProject/RVO/RVOController.cs @@ -163,6 +163,9 @@ namespace Pathfinding.RVO { /** Enables drawing debug information in the scene view */ public bool debug; + public string agentName; + public string ignoredAgentName; + /** Current position of the agent. * Note that this is only updated every local avoidance simulation step, not every frame. */ @@ -317,6 +320,8 @@ namespace Pathfinding.RVO { rvoAgent.Layer = layer; rvoAgent.CollidesWith = collidesWith; rvoAgent.Priority = priority; + rvoAgent.agentName = agentName; + rvoAgent.ignoredAgentName = ignoredAgentName; float elevation; // Use the position from the movement script if one is attached