Description
The AgentRadius
property of the NavMesh
class specifies the radius of the navigation agent. This property is crucial for determining how much space is left between the agent and the edges of surfaces, ensuring that the agent does not clip into walls or other obstacles. Adjusting the AgentRadius
can help in fine-tuning the navigation mesh to better fit the dimensions and movement constraints of the agent.
Usage
To use the AgentRadius
property, you can get or set its value directly on an instance of the NavMesh
class. This property is a float
and should be set according to the size of the agent you are simulating.
Example
// Example of setting the AgentRadius property
NavMesh navMesh = new NavMesh();
navMesh.AgentRadius = 0.5f; // Set the agent radius to 0.5 units
// Example of getting the AgentRadius property
float currentRadius = navMesh.AgentRadius;
// Use currentRadius as needed