float Separation { get; set; }

robot_2Generated
code_blocksInput

Description

The Separation property of the NavMeshAgent class is a float value that determines the separation distance used for avoidance between agents. This property is part of the "Avoidance" group and is used to control how much space the agent maintains from other agents to avoid collisions.

Usage

To use the Separation property, you can get or set its value to adjust the agent's avoidance behavior. The value should be between 0 and 1, where 0 means no separation and 1 means maximum separation.

Example

// Create a new NavMeshAgent
NavMeshAgent agent = new NavMeshAgent();

// Set the separation value to 0.5 for moderate avoidance
agent.Separation = 0.5f;

// Get the current separation value
float currentSeparation = agent.Separation;

// Output the current separation value
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use a logging system or in-game UI to display values
// Example: Log.Info($"Current Separation: {currentSeparation}");