This page has been translated automatically.
Основы UNIGINE
1. Введение
3. Подготовка 3D моделей
4. Материалы
5. Камеры и освещение
6. Реализация логики приложения
7. Создание кат-сцен и запись видео
8. Подготовка проекта к релизу
9. Физика
10. Основы оптимизации
11. ПРОЕКТ2: Шутер от первого лица
12. ПРОЕКТ3: Аркадная гонка по пересеченной местности от 3-го лица
13. ПРОЕКТ4: VR приложение с простым взаимодействием

Инстансинг объектов

The virtual world that you create may contain many identical objects, such as electrical supports, cars, wheels, etc. These objects should always look the same, and if you clone them, many separate copies are created. This means that if you decide to make any changes to one of the copies (for example, change geometry or some materials of an object), you will have to do it for each copy separately.Создаваемый вами виртуальный мир может содержать множество идентичных объектов, которые всегда должны выглядеть одинаково, например, электрические опоры, автомобили, колеса и т.д. При клонировании этих объектов создается множество отдельных копий. Таким образом, если вы решите что-то изменить (например, геометрию или материалы некоторых частей опор ЛЭП), вам придется сделать это для каждой копии отдельно.

To avoid this, it is convenient to use a template and replicate its instances of it in the scene. UNIGINE has Node Reference for this purpose.Для идентичных объектов, особенно сложных, удобно использовать шаблон и тиражировать в сцене его экземпляры. В UNIGINE для этого есть Node Reference.

First you create and customize a hierarchy of objects with assigned materials, components, physical parameters, and so on (for example, a helicopter with numerous nodes and parts). You save this finished template to a separate file (with the *.node extension), and then add instances of this template to the scene. Each of the added instances references the template.Сначала вы собираете и настраиваете иерархию объектов с назначенными материалами, компонентами, физическими параметрами и так далее (например, вертолет с множеством узлов и деталей). Сохраняете этот готовый шаблон в отдельный файл (с расширением *.node), а затем добавляете в сцену экземпляры этого шаблона. Каждый из экземпляров ссылается на шаблон.

Creating and Exporting the Template Node
Подготовка и экспорт шаблонной сборки
#

To create a template of a complex object, you need to follow these steps:Алгоритм создания шаблона сложного объекта выглядит так:

  1. Create the base hierarchy. Prepare the base hierarchy that will represent your object. For example, if you want to use a helicopter repeatedly in your world, assemble a hierarchy of nodes with materials, animations, logic components, and everything else that you need. Создание базовой иерархии. Прежде всего мы должны подготовить базовую иерархию, которая будет представлять наш объект. Предположим, мы собрали иерархию нод с материалами, анимациями, компонентами логики и всем остальным для вертолета, который собираемся многократно использовать в нашем мире.

  2. Convert the node hierarchy into a Node Reference. Simply drag and drop the root node of the hierarchy to the desired folder in Asset Browser. A corresponding *.node (template) asset containing the hierarchy will be created in the folder. The node hierarchy in the world will be replaced by a reference to this asset.Преобразование иерархии нод в Node Reference. Просто перетащите корневую ноду иерархии в нужную папку в Asset Browser. В папке будет создан соответствующий ассет *.node (шаблон), содержащий иерархию. А иерархия нод в мире заменится ссылкой на этот ассет.

  3. Place instances. The first instance in the world is the one that replaced the hierarchy when you dragged it into Asset Browser. You can add other instances by dragging the desired *.node template from Asset Browser directly to the scene or by cloning the Node Reference like any other node (Shift+Drag).Размещение экземпляров. Итак, первый экземпляр в мире – это тот, что заменил иерархию, когда мы перетащили ее в Asset Browser. Добавить другие экземпляры можно перетащив нужный шаблон *.node из Asset Browser прямо на сцену, либо клонировав Node Reference, как и любую другую ноду (Shift+Drag).

Benefits When Editing
Преимущества редактирования
#

When you edit any instance and save the changes, the template and all other instances are automatically updated. This approach ensures integrity when changing the parameters of reusable objects, especially if they are complex. This process looks as follows:При редактировании любого экземпляра и сохранении изменений происходит автоматическое обновление шаблона и всех остальных экземпляров. Такой подход обеспечивает целостность при изменении параметров многократно используемых объектов, особенно если они сложные.Вот как выглядит процесс:

  1. Select any instance in the world through the Editor Viewport or World Nodes Hierarchy window. The Node Reference parameters will be displayed in the Parameters window.Выберите любой экземпляр в мире через окно Editor Viewport или World Nodes Hierarchy. Параметры Node Reference отобразятся в окне Parameters.

  2. Click Edit. The hierarchy of the original Node Reference will be displayed in the World Nodes Hierarchy window.Щелкните Edit. Иерархия исходного Node Reference отобразится в окне World Nodes Hierarchy.

  3. Edit the source Node Reference. You can make any changes: change materials, add new nodes, delete existing nodes, etc.Отредактируйте исходный Node Reference. Вы можете вносить любые изменения: изменять материалы, добавлять новые ноды, удалять существующие и т.д.
  4. Click Apply to save your changes or Cancel to discard them. The changes will be applied to all instances at once.Щелкните Apply, чтобы сохранить внесенные изменения, или Cancel, чтобы отменить их. Изменения будут применены ко всем экземплярам сразу.

Important Notes
Особенности работы с Node Reference
#

A Node Reference can contain only one root node.Node Reference может содержать только одну корневую ноду.

Referencing the Node Reference Content from Outside
Ссылка на содержимое Node Reference извне
#

Node Reference should be thought of as a container for a self-sufficient hierarchy of nodes. When designing your world in UnigineEditor, avoid referencing nodes that are stored in a Node Reference directly from the outside (e.g. when creating physical joints, specifying nodes in component parameters or the target node of Player Persecutor, or when controlling nodes animation via the Tracker tool that we'll review a bit later) as such references will be lost as soon as the world is reloaded.Node Reference следует рассматривать как контейнер для самодостаточной иерархии нод. При проектировании вашего мира в UnigineEditor избегайте ссылок на ноды, которые хранятся в Node Reference, непосредственно извне (например, при создании физических сочленений, указании нод в параметрах компонента или в качестве целевой ноды Player Persecutor, а также при управлении анимацией нод через инструмент Tracker, о котором мы расскажем чуть позже), поскольку такие ссылки будут потеряны сразу после перезагрузки мира.

Transformations
Трансформации
#

The transformation of Node Reference is not affected by the transformation of the nodes stored in it. Thus, logic-driven and physics-driven nodes inside Node Reference will make no influence on its direct children.Трансформации Node Reference не зависят от трансформаций хранимых в ней нод. Таким образом, управляемые логикой и физикой ноды внутри Node Reference не будут оказывать никакого влияния на его прямые дочерние элементы.

In the following example, the moving grouped Node_1 and Node_2 nodes (e.g. driven by physics) contained by a Node Reference will not change the transformation of the Node Reference and, therefore, the DirectChild node will not be affected as well.В следующем примере движущиеся сгруппированные ноды Node_1 и Node_2 (например, управляемые физикой), содержащиеся в Node Reference, не изменят трансформацию Node Reference и, следовательно, нода DirectChild также не изменит своего положения.

Schematic representation of Node Reference content

Schematic representation of Node Reference contentСхематическое представление содержимого Node Reference.

So, it is recommended to enclose all interconnected nodes in a single Node Reference to ensure logical and hierarchical integrity.Таким образом, рекомендуется заключить все взаимосвязанные ноды в один Node Reference для обеспечения логической и иерархической целостности.

Последнее обновление: 18.01.2024
Build: ()