/// Note: If a movement script (AIPath/RichAI/AILerp, anything implementing the IAstarAI interface) is attached to the same GameObject, this value will be driven by that script.
/// </summary>
publicfloatradius{
get{
if(ai!=null)returnai.radius;
returnradiusBackingField;
}
set{
if(ai!=null)ai.radius=value;
radiusBackingField=value;
}
}
/// <summary>
/// Height of the agent in world units.
/// Note: If a movement script (AIPath/RichAI/AILerp, anything implementing the IAstarAI interface) is attached to the same GameObject, this value will be driven by that script.
/// </summary>
publicfloatheight{
get{
if(ai!=null)returnai.height;
returnheightBackingField;
}
set{
if(ai!=null)ai.height=value;
heightBackingField=value;
}
}
/// <summary>A locked unit cannot move. Other units will still avoid it but avoidance quality is not the best.</summary>
[Tooltip("A locked unit cannot move. Other units will still avoid it. But avoidance quality is not the best")]
publicboollocked;
/// <summary>
/// Automatically set <see cref="locked"/> to true when desired velocity is approximately zero.
/// This prevents other units from pushing them away when they are supposed to e.g block a choke point.
///
/// When this is true every call to <see cref="SetTarget"/> or <see cref="Move"/> will set the <see cref="locked"/> field to true if the desired velocity
/// was non-zero or false if it was zero.
/// </summary>
[Tooltip("Automatically set #locked to true when desired velocity is approximately zero")]
publicboollockWhenNotMoving=false;
/// <summary>How far into the future to look for collisions with other agents (in seconds)</summary>
[Tooltip("How far into the future to look for collisions with other agents (in seconds)")]
publicfloatagentTimeHorizon=2;
/// <summary>How far into the future to look for collisions with obstacles (in seconds)</summary>
[Tooltip("How far into the future to look for collisions with obstacles (in seconds)")]
publicfloatobstacleTimeHorizon=2;
/// <summary>
/// Max number of other agents to take into account.
/// A smaller value can reduce CPU load, a higher value can lead to better local avoidance quality.
/// </summary>
[Tooltip("Max number of other agents to take into account.\n"+
"A smaller value can reduce CPU load, a higher value can lead to better local avoidance quality.")]
publicintmaxNeighbours=10;
/// <summary>
/// Specifies the avoidance layer for this agent.
/// The <see cref="collidesWith"/> mask on other agents will determine if they will avoid this agent.
/// </summary>
publicRVOLayerlayer=RVOLayer.DefaultAgent;
/// <summary>
/// Layer mask specifying which layers this agent will avoid.
/// You can set it as CollidesWith = RVOLayer.DefaultAgent | RVOLayer.Layer3 | RVOLayer.Layer6 ...
///
/// This can be very useful in games which have multiple teams of some sort. For example you usually
/// want the agents in one team to avoid each other, but you do not want them to avoid the enemies.
///
/// This field only affects which other agents that this agent will avoid, it does not affect how other agents
/// react to this agent.
///
/// See: bitmasks (view in online documentation for working links)
/// This can be good way to reduce "wall hugging" behaviour.
///
/// Deprecated: This feature is currently disabled as it didn't work that well and was tricky to support after some changes to the RVO system. It may be enabled again in a future version.
/// </summary>
[HideInInspector]
[System.Obsolete]
publicfloatwallAvoidForce=1;
/// <summary>
/// How much the wallAvoidForce decreases with distance.
/// The strenght of avoidance is:
/// <code> str = 1/dist*wallAvoidFalloff </code>
///
/// See: wallAvoidForce
///
/// Deprecated: This feature is currently disabled as it didn't work that well and was tricky to support after some changes to the RVO system. It may be enabled again in a future version.
[Tooltip("How strongly other agents will avoid this agent")]
[UnityEngine.Range(0, 1)]
publicfloatpriority=0.5f;
/// <summary>
/// Center of the agent relative to the pivot point of this game object.
/// Note: If a movement script (AIPath/RichAI/AILerp, anything implementing the IAstarAI interface) is attached to the same GameObject, this value will be driven by that script.
/// </summary>
publicfloatcenter{
get{
// With an AI attached, this will always be driven to height/2 because the movement script expects the object position to be at its feet
if(ai!=null)returnai.height/2;
returncenterBackingField;
}
set{
centerBackingField=value;
}
}
/// <summary>\details Deprecated:</summary>
[System.Obsolete("This field is obsolete in version 4.0 and will not affect anything. Use the LegacyRVOController if you need the old behaviour")]
publicLayerMaskmask{get{return0;}set{}}
/// <summary>\details Deprecated:</summary>
[System.Obsolete("This field is obsolete in version 4.0 and will not affect anything. Use the LegacyRVOController if you need the old behaviour")]
publicboolenableRotation{get{returnfalse;}set{}}
/// <summary>\details Deprecated:</summary>
[System.Obsolete("This field is obsolete in version 4.0 and will not affect anything. Use the LegacyRVOController if you need the old behaviour")]
publicfloatrotationSpeed{get{return0;}set{}}
/// <summary>\details Deprecated:</summary>
[System.Obsolete("This field is obsolete in version 4.0 and will not affect anything. Use the LegacyRVOController if you need the old behaviour")]
publicfloatmaxSpeed{get{return0;}set{}}
/// <summary>Determines if the XY (2D) or XZ (3D) plane is used for movement</summary>
/// Direction and distance to move in a single frame to avoid obstacles.
///
/// The position of the agent is taken from the attached movement script's position (see <see cref="Pathfinding.IAstarAI.position)"/> or if none is attached then transform.position.
/// </summary>
/// <param name="deltaTime">How far to move [seconds].