This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

World Expression

World Expression is a point object, which executes arbitrary expressions (scripts) within the specified distance and at a set frame rate. By default, expressions are executed at the same frame rate as the main application.World Expression - точечный объект, который выполняет произвольные выражения (скрипты) в пределах указанного расстояние и при наборе частота кадров . По умолчанию выражения выполняются с той же частотой кадров, что и основное приложение.

Примечание
An expression is executed only if it's within the specified distance from the camera.Выражение выполняется только в том случае, если оно находится в пределах указанного расстояние с камеры.

By using World Expression, you can attach a script to an object in the scene. To do that, such object must be added as a child node to World Expression. Child nodes inherit transformations (if any) of the World Expression node.Используя World Expression, вы можете прикрепить скрипт к объекту в сцене. Для этого такой объект необходимо добавить как дочерний узел к World Expression. Дочерние узлы наследуют преобразования (если есть) узла World Expression.

Примечание
Child nodes are transformed relative to the pivot point of the World Expression node.Дочерние узлы преобразуются относительно точки поворота узла World Expression.

If there are nested World Expression nodes, the child node of the last World Expression in the hierarchy inherits transformations of all parent World Expression nodes.Если есть вложенные узлы World Expression, дочерний узел последнего World Expression в иерархии наследует преобразования всех родительских узлов World Expression.

For example, by using World Expression, you can transform objects in the scene, turn on and off sounds with the distance, turn on and off NPC behavior, attach objects to the camera (e.g. drops of the rain on the camera), and so on.Например, используя World Expression, вы можете трансформировать объекты в сцене, включать и выключать звуки в зависимости от расстояния, включать и выключать поведение NPC, прикреплять объекты к камере (например, капли дождя на камере) и т.д. .

Mesh Dynamic nodes added as children to the nested World Expression nodesУзлы Mesh Dynamic добавлены как дочерние к вложенным узлам World Expression

See alsoСмотрите также#

Creating World ExpressionСоздание World Expression#

To create World Expression via UnigineEditor:Чтобы создать World Expression через UnigineEditor:

  1. On the Menu bar, click Create -> Logic -> Expression.В Меню , выберите Create -> Logic -> Expression.

  2. Place the World Expression somewhere in the world.Разместите World Expression где-нибудь в мире.

Attaching World Expression ScriptПрикрепление скрипта World Expression Script#

There are two ways of attaching a World Expression script via UnigineEditor:Есть два способа прикрепить скрипт World Expression через UnigineEditor:

  • Directly in UnigineEditor in the Source field of the World Expression section in the Parameters window. Source code must be inside the curly braces {}, as they define the World Expression scope.Непосредственно в UnigineEditor в поле Source раздела World Expression в окне Parameters. Исходный код должен быть внутри фигурных скобок {}, поскольку они определяют область действия World Expression.

  • Attached as a script file in the File field of the World Expression section. The script file should be included in the World Expression scope in the Source field using the curly braces {}:Прикрепление в виде файла сценария в поле File раздела World Expression. Файл сценария должен быть включен в область видимости World Expression в поле Source с использованием фигурных скобок {}:

    In this case, the my_expression.h file should contain the following code:В этом случае файл my_expression.h должен содержать следующий код:

    Исходный код (UnigineScript)
    log.message("WorldExpression is updated\n");
    Примечание
    In the script file, the source code must not be wrapped in the curly braces {}.В файле сценария исходный код не должен заключаться в фигурные скобки {}.

Implementing ScriptРеализация скрипта#

The script itself can be implemented as a simple sequence of functions' calls or as a set of functions and classes. See examples here.Сам скрипт может быть реализован как простая последовательность вызовов функций или как набор функций и классов. Посмотреть примеры можно здесь .

Примечание
It is recommended to implement simple scripts.Рекомендуется реализовывать простые скрипты.

Inter-Script CommunicationМежскриптовое взаимодействие#

Such script can communicate with the world script via the corresponding engine.world class functions or with World Trigger via callbacks (see the samples listed above).Такой сценарий может общаться со сценарием мира через соответствующие функции класса engine.world или с помощью World Trigger через обратные вызовы (см. перечисленные примеры выше ).

Script FunctionsФункции скрипта#

Besides functions of the UnigineScript library, there is also a set of internal functions that are available within the World Expression script. The list of such functions with descriptions and examples can be found here.Помимо функций библиотеки UnigineScript, есть также набор внутренних функций, доступных в скрипте World Expression. Список таких функций с описанием и примерами можно найти здесь .

Setting World Expression ParametersУстановка параметров World Expression#

You can adjust the following parameters of World Expression in the Node tab: Вы можете настроить следующие параметры World Expression на вкладке Node:

Update Distance Limit Distance from the camera, within which the expression is executed.Расстояние от камеры, в пределах которой выполняется выражение.
IFps A constant frame duration (inverse FPS, 1/FPS) used to execute the expression. If 0 is set, the expression is executed at the same frame rate as the main application.Постоянная длительность кадра (обратный FPS, 1 / FPS), используемая для выполнения выражения. Если установлен 0, выражение выполняется с той же частотой кадров, что и основное приложение.
File

A path to a file with a World Expression script to be executed. The path is relative to the data directory. This file should be included in the World Expression scope in the Source field. This field is optional as the World Expression script can be implemented directly via the UnigineEditor interface.Путь к файлу с исполняемым скриптом World Expression. Путь указан относительно каталога data. Этот файл должен быть включен в область видимости World Expression в поле Source. Это поле является необязательным, поскольку сценарий World Expression может быть реализован непосредственно через интерфейс UnigineEditor.

Примечание
If the script file is changed, it should be refreshed via UnigineEditor: click to the right of the File field.Если файл скрипта был изменен, его следует обновить через UnigineEditor: щелкните справа от поля File.
Source

Source code of a World Expression script. This field can contain:Исходный код скрипта World Expression. Это поле может содержать:

Примечание
In both cases, the curly braces {} must wrap the code in the field.В обоих случаях фигурные скобки {} должны заключать код в поле.
Последнее обновление: 24.06.2021
Build: ()