Creating and configuring a config via code - Nav3D Doc

Docy Child

Creating and configuring a config via code

All Nav3DAgentConfig parameters can be configured through the code as well.

To do this, you should create a Nav3DAgentConfig instance, set correct parameter values, and then apply the instance to the agent.

  • It is suggested to use Nav3DAgentConfig.DefaultConfig to create a new instance.
  • There is a Copy() method to get a copy of the instance.
  • To apply config to the agent it is needed to use the Nav3DAgent.SetConfig(Nav3DAgentConfig _Config) method.

Below is an example of creating a Nav3DAgentConfig instance and applying it to an agent.

				
					void ConfigureAgentConfig()
{
   Nav3DAgent myAgent = GetComponent<Nav3DAgent>();

   //create Nav3DAgentConfig instance with default parameters
   Nav3DAgentConfig myConfig = Nav3DAgentConfig.DefaultConfig;

   //set the parameters you want
   myConfig.Radius = 1.2f;
   myConfig.MotionNavigationType = MotionNavigationType.LOCAL;

   //apply config to agent
   myAgent.SetConfig(myConfig.Copy());
}

				
			

Nav3DSphereShell

Represents a spherical shell that is perceived by other agents as an object to a...

Nav3DEvader

There is also a separate controller, whose behavior consists of just avoiding ne...

Nav3DAgentManager

This class implements several methods to get a list of all Nav3DAgents located i...

Nav3DPathTester

We implemented a useful component (Nav3DPathTester), which can be used while bui...

PathfindingResult

Contains the pathfinding data and time statistics. Time statistics: public TimeS...

Nav3DPath: Events

For the convenience of notification when the pathfinding finished, the following...

Agent log

Here you can copy the contents of the agent log to the clipboard by clicking the...

Debug drawing

In this section, you can visualize the agent and his nearest environment. This s...

Creating and configuring a config via code

All Nav3DAgentConfig parameters can be configured through the code as well. To ...

Nav3DManager

Nav3DManager is a helper static class. Can be useful for checking whether Nav3D ...

Nav3DInitializer

To use Nav3D in playmode, you need to initialize it. The Nav3DInitializer compon...

Nav3DObstacleLoader

To use the possibility of pre-baking obstacles on the scene in editor mode and t...

Chat Icon Close Icon
en_USEnglish