Creating and configuring an agent description from code - Nav3D Doc

Docy Child

Создание и настройка описания агента из кода

Все параметры Nav3DAgentDescription , настроенные в инспекторе описаний, также могут быть настроены из вашего кода.

Для этого вам нужно создать переменную типа Nav3DAgentDescription, затем применить ее к агенту. Правильный способ создания описание - обращение к свойству Nav3DAgentDescription.DefaultDescription .

После задания желаемых параметров в коде, нужно установить агенту настроенное описание.

Если ваше описание содержит параметры, значение которых настроено на случайную генерацию, то перед установкой описания агенту необходимо получить вариант описания с сгенерированными параметрами. Правильный способ получить экземпляр описания для установки агенту — это использовать Nav3DAgentDescription.GetDescriptionVariant() Обращение к этому методу гарантирует создание отдельного экземпляра описания с учетом сгенерированных параметров. Мы рекомендуем вам всегда использовать метод GetDescriptionVariant() , чтобы задать описание для агента с помощью кода.

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

   //create Nav3DAgentDescription instance with default parameters
   Nav3DAgentDescription myDescription = Nav3DAgentDescription.DefaultDescription;

   //set the parameters you want
   myDescription.Radius = 1.2f;
   myDescription.MotionNavigationType = MotionNavigationType.LOCAL;
  
   //apply the description to an agent
   myAgent.SetDescription(myDescription.GetDescriptionVariant());
}
				
			

Agent log

In the second section, you can get the contents of the agent log by clicking on ...

Debug drawing

In the first section, you can visualize the agent and his nearest environment. T...

Создание и настройка описания агента из кода

All Nav3DAgentDescription parameters configured in the description inspector c...

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...

Nav3DObstacle

To manage obstacles on the scene, the Nav3DObstacle component is designed. Attac...

Сочетания препятствий

We will call obstacles with the selected processing mode “Runtime” as runtim...

Операции с препятствиями

Regardless of the obstacle processing mode, the processing procedure consists of...

Немного глубже о препятствиях

As already described above, in order for an obstacle to be taken into account du...

Nav3DAgent : Debug

The Nav3DAgent and its inheritors have an inspector that provides several useful...

Nav3DAgent

As mentioned above, you can use the Nav3DAgent script as a component for your ga...

Chat Icon Close Icon
ru_RURussian