This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Professional (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Декали
Источники света
Geodetics
World Nodes
Звуковые объекты
Объекты поиска пути
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Materials and Shaders
Rebuilding the Engine Tools
GUI
Двойная точность координат
API
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
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Сэмплы материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Физический триггер (Physical Trigger)

The Physical Trigger is an object firing callbacks when physical objects get inside or outside of it. There are 4 types of physical triggers based on their shape:Physical Trigger - это объект, выполняющий функции обратного вызова, когда физические объекты попадают внутрь или за пределы него. В зависимости от формы существует 4 типа физических триггеров:

  • Sphere trigger of the specified radiusСферический триггер указанного радиуса
  • Capsule trigger of the specified radius and heightКапсульный триггер указанного радиуса и высоты
  • Cylinder trigger of the specified radius and heightЦилиндрический триггер указанного радиуса и высоты
  • Box trigger of the specified size along the axesТриггер в форме куба заданного размера по осям

To be detected by the trigger, a physical object must have both a physical body (with the Physical mask that matches the Physical mask of the trigger) and a shape (with the Collision mask that matches the Collision mask of the trigger).Для обнаружения срабатывания триггера физический объект должен иметь как физическое тело (с маской Physical, которая соответствует маске Physical триггера) и коллизионную форму (с маской Collision, которая соответствует маске Collision триггера).

It is also possible to specify the Exclusion mask for the Physical Trigger that is used to prevent detecting collisions with shapes. This mask is independent of the Collision mask.Также можно указать маску Exclusion для Physical Trigger, которая используется для предотвращения обнаружения столкновений с другими формами (shapes). Эта маска не зависит от маски Collision.

  • For a body with a shape, the Exclusion mask can be set on the Physics tab of the Parameters panel.Для тела с формой (shape) маска Exclusion может быть установлена на вкладке Physics панели Parameters.
  • For the Physical Trigger, the mask can be set via C++, C# or UnigineScript API.Для Physical Trigger маска может быть установлена через C ++, C # или UnigineScript API .

To avoid collision detection between a shape and a Physical Trigger, the following conditions must be met:Чтобы избежать обнаружения столкновений между фигурой и Physical Trigger, должны быть выполнены следующие условия:

  • The Collision mask set for the shape must match the Collision mask of the Physical Trigger.Маска Collision, установленная для фигуры, должна совпадать с маской Collision из Physical Trigger.
  • The Exclusion mask set for the shape must match the Exclusion mask of the Physical Trigger.Маска Exclusion, установленная для фигуры, должна совпадать с маской Exclusion из Physical Trigger.

Physical objects participating in the contact with the Physical Trigger can be obtained via API. The shape of such object scan also be obtained. Moreover, you can get the depth of the object penetration, coordinates of the contact point, and its normal.Физические объекты, участвующие в контакте с Physical Trigger, можно получить через API. Также можно получить конкретную форму (shape) такого объекта. Кроме того, вы можете получить глубину проникновения объекта, координаты точки контакта и нормали к ней.

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

Adding Physical TriggerДобавление физического триггера#

To add a Physical Trigger to the scene via UnigineEditor:Чтобы добавить Physical Trigger в сцену через UnigineEditor:

  1. Run the project with UnigineEditor.Запустите проект с UnigineEditor.
  2. On the Menu bar, click Create -> Logic -> Physical Trigger.В главном меню выберите Create -> Logic -> Physical Trigger.

  3. Click somewhere in the world to place the Physical Trigger.Щелкните где-нибудь в мире, чтобы разместить файл Physical Trigger.

A new Physical Trigger node will be added to UnigineEditor, and you will be able to edit it via the Parameters window. By default, the sphere trigger with 1-unit radius is created.Новый узел Physical Trigger будет добавлен в UnigineEditor, и вы сможете редактировать его через окно Parameters. По умолчанию создается сферический триггер с радиусом 1.

Editing Physical TriggerРедактирование физического триггера#

In the Physical Trigger section (Parameters window -> Node tab), you can adjust the following parameters of the physical trigger:В разделе Physical Trigger (окно Parameters → вкладка Node) вы можете настроить следующие параметры физического триггера:

Edit Size

Toggles the editing mode for the Physical Trigger node. When enabled, the size or the radius of the node (depending on its type) can be changed: each side/axis is highlighted with the colored rectangle/circle. To change the size/radius, drag the corresponding rectangle/circle.Переключает режим редактирования для узла Physical Trigger. При включении размер или радиус узла (в зависимости от его тип ) можно изменить: каждая сторона / ось выделяется цветным прямоугольником / кружком. Чтобы изменить размер / радиус, перетащите соответствующий прямоугольник / круг.

Editing of sphere-shaped physical triggerРедактирование сферического физического триггера
Physical Mask The Physical mask of the Physical Trigger must match the Physical mask of the physical object. Otherwise, the Physical Trigger won't fire callbacks when the object enters or leaves it.Маска Physical для Physical Trigger должна совпадать с маской Physical физического объекта. В противном случае Physical Trigger не будет запускать обратные вызовы, когда объект входит или выходит из него.
Collision Mask
  • In case of the physical object, the Collision mask of the Physical Trigger must match the Collision mask of the physical object's shape.В случае физического объекта маска Collision для Physical Trigger должна совпадать с маской Collision формы физического объекта.
  • In case of the non-physical collider object, the Collision mask of the Physical Trigger must match the Collision mask of the object's surface.В случае нефизического объекта коллайдера маска Collision для Physical Trigger должна совпадать с маской Collision поверхности объекта.
Type Type of the Physical Trigger: sphere, capsule, cylinder, or box.Тип файла Physical Trigger: sphere, capsule, cylinder или box.
Size

Size of the Physical Trigger, namely:Размер Physical Trigger, а именно:

  • Radius in case of a sphereРадиус в случае шара
  • Radius and height in case of a capsule or a cylinderРадиус и высота в случае капсулы или цилиндра
  • Dimensions in case of a boxРазмеры в случае параллелепипеда

Setting Up CallbacksНастройка обратных вызовов#

To add an enter or leave callback, write a callback function that receives a Body as its first argument. Then use an addEnterCallback() or addLeaveCallback method to specify the function to be called.Чтобы определить действия, выполняемые при входе в триггер или выходе из него, напишите функцию обратного вызова, которая получает Body в качестве своего первого аргумента. Затем используйте метод addEnterCallback() или addLeaveCallback, чтобы указать вызываемую функцию.

Исходный код (C++)
// add the enter callback to be fired when a body enters the physical trigger
physicalTrigger->addEnterCallback(MakeCallback(this, &AppWorldLogic::enter_callback));
// add the leave callback to be fired when a body leaves the physical trigger
physicalTrigger->addLeaveCallback(MakeCallback(this, &AppWorldLogic::leave_callback));
Исходный код (C#)
// add the enter callback to be fired when a body enters the physical trigger
physicalTrigger.addEnterCallback(enter_callback);
// add the leave callback to be fired when a body leaves the physical trigger
physicalTrigger.addLeaveCallback(leave_callback);
Последнее обновление: 10.03.2022
Build: ()