This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Программирование на C#
Рендеринг
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Setting Up Properties
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
UnigineScript
C++
C#
Унифицированный язык шейдеров UUSL
File Formats
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
Работа с контентом
Оптимизация контента
Материалы
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Коллизионные формы (Shapes)

While a body simulates various types of physical behavior, a shape represents the volume of space occupied by a physical body. A physically simulated object usually has one body and one or several shapes which allow objects to collide with each other (therefore, shapes are often referred as collision shapes). Objects with shapes also fall under gravity, bounce off static surfaces or slide along them. A body without a single shape assigned behaves as a dummy body that can be connected to other bodies using joints, but does not collide and is immune to gravity. В то время как тело (body) имитирует различные типы физического поведения, форма (shape) представляет собой объем пространства, занимаемого физическим телом. Физически моделируемый объект обычно имеет одно тело и одну или несколько форм, которые позволяют объектам сталкиваться друг с другом (поэтому формы часто называют формами столкновения). Объекты с формой также падают под действием силы тяжести, отскакивают от статичных поверхностей или скользят по ним. Тело, которому не назначена единственная форма, ведет себя как фиктивное тело , которое может быть соединено с другими телами с помощью сочленений , но не сталкивается и невосприимчиво к гравитации.

Basic shape types are as follows: Основные типы форм следующие:

Simple primitives make collision calculations easier while keeping performance high and accuracy acceptable. Convex hulls provide higher precision, however, continuous collision detection is not available for this type of shape. Therefore, convex hulls should not be used for fast-moving objects. Простые примитивы упрощают вычисление столкновений, сохраняя при этом высокую производительность и приемлемую точность. Выпуклые оболочки обеспечивают более высокую точность, однако непрерывное обнаружение столкновений недоступно для этого типа формы. Следовательно, выпуклые оболочки не должны использоваться для быстро движущихся объектов.

Примечание
A shape doesn't have to duplicate the mesh it approximates. It is recommended to use simple primitives. Even though they are not precise, in the majority of cases they provide acceptable results.
The number of shapes should be kept as low as possible. Otherwise, heavy physics calculations will decrease the performance.
Форма не должна дублировать сетку, которую она приближает. Рекомендуется использовать простые примитивы. Несмотря на то, что они неточны, в большинстве случаев они обеспечивают приемлемые результаты.
Число форм должно быть как можно меньше . В противном случае тяжелые физические вычисления снизят производительность.

A shape cannot be created without a body and does not have its own position in world coordinates. It is always assigned to a body and positioned relative to it. Форма (shape) не может быть создана без тела (body) и не имеет собственной позиции в мировых координатах. Он всегда присваивается телу и позиционируется относительно него.

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

Programming implementation: Программная реализация:

Shape ParametersПараметры формы#

All shapes regardless of their type have the following common parameters Все формы независимо от их типа имеют следующие общие параметры

Shape parameters

Enabled A flag indicating if a shape is enabled. Флаг, указывающий, включена ли форма.
Continuous A flag indicating if the continuous collision detection is enabled for the shape.
Примечание
Continuous collision detection is available for sphere and capsule shapes only.Continuous collision detection is available for sphere and capsule shapes only.
Continuous collision detection is available for sphere and capsule shapes only.
Флаг, указывающий, включено ли непрерывное обнаружение столкновений для формы.
Примечание
Continuous collision detection is available for sphere and capsule shapes only. Непрерывное обнаружение столкновений доступно только для сфер и капсул.
Mass Mass of the shape. Changing the mass influences the density, which is calculated by dividing the mass by shape volume. In case if there are several shapes assigned to a body (e.g. a set of convex hulls) Масса формы. Изменение массы влияет на плотность, которая рассчитывается путем деления массы на объем формы. В случае, если телу присвоено несколько форм (например, набор выпуклых оболочек)
Density Density of the shape. Changing the density influences the mass, which is calculated by multiplying shape volume by density. Плотность формы. Изменение плотности влияет на массу, которая рассчитывается путем умножения объема формы на плотность.
Friction Coefficient of friction of the shape. Defines how rough the shape's surface is. The higher the value, the less tendency the shape has to slide.
Примечание
In case if an object contains a surface and a shape, both with specified friction parameter, only the shape's parameter will be used.In case if an object contains a surface and a shape, both with specified friction parameter, only the shape's parameter will be used.
In case if an object contains a surface and a shape, both with specified friction parameter, only the shape's parameter will be used.
Коэффициент трения формы. Определяет шероховатость поверхности формы. Чем выше значение, тем меньше тенденция к скольжению формы.
Примечание
In case if an object contains a surface and a shape, both with specified friction parameter, only the shape's parameter will be used. В случае, если объект содержит поверхность и форму, оба с указанным параметром трения, будет использоваться только параметр формы.
Restitution Coefficient of restitution of the shape. Defines how bouncy the shape is when colliding.
  • The minimum value of 0 indicates inelastic collisions (a piece of soft clay hitting the floor)The minimum value of 0 indicates inelastic collisions (a piece of soft clay hitting the floor)
  • The maximum value of 1 represents highly elastic collisions (a rubber ball bouncing off a wall)The maximum value of 1 represents highly elastic collisions (a rubber ball bouncing off a wall)
Примечание
In case if an object contains a surface and a shape, both with specified restitution parameter, only the shape's parameter will be used.In case if an object contains a surface and a shape, both with specified restitution parameter, only the shape's parameter will be used.
The minimum value of 0 indicates inelastic collisions (a piece of soft clay hitting the floor)The maximum value of 1 represents highly elastic collisions (a rubber ball bouncing off a wall)In case if an object contains a surface and a shape, both with specified restitution parameter, only the shape's parameter will be used.
Коэффициент восстановления формы. Определяет упругость формы при столкновении.
  • The minimum value of 0 indicates inelastic collisions (a piece of soft clay hitting the floor) Минимальное значение 0 указывает на неупругие столкновения (кусок мягкой глины, ударяющийся об пол)
  • The maximum value of 1 represents highly elastic collisions (a rubber ball bouncing off a wall) Максимальное значение 1 соответствует очень упругому столкновению (резиновый мяч, отскакивающий от стены).
Примечание
In case if an object contains a surface and a shape, both with specified restitution parameter, only the shape's parameter will be used. В случае, если объект содержит поверхность и форму, оба с указанным параметром восстановления, будет использоваться только параметр формы.
Position Position of the shape in the coordinates of the body. Положение формы в координатах тела (body).
Rotation Rotation of the shape in the coordinates of the body. Вращение формы в координатах тела (body).
Physics Intersection mask Physics Intersection bit mask of the shape. Битовая маска формы Physics Intersection.
Collision mask Collision bit mask of the shape. This mask is used to specify collisions of the shape with other ones. Битовая маска столкновения формы. Эта маска используется для указания столкновений формы с другими.
Exclusion mask Exclusion bit mask of the shape. This mask is used to prevent collisions of the shape with other ones. Битовая маска исключения формы. Эта маска используется для предотвращения столкновения формы с другими.

Our video tutorial on physics contains an overview of the shape parameters and clarification on how to use the Exclusion and Collision masks. Наш видеоурок по физике содержит обзор параметров формы и разъяснения по использованию Exclusion и Collision masks .

Adding a ShapeДобавление формы#

To add a shape via UnigineEditor, perform the following steps: Чтобы добавить форму через UnigineEditor , выполните следующие шаги:

You can enable visualization of shapes by checking Helpers panel → Physics item → Shapes option (Visualizer should be enabled). Вы можете включить визуализацию форм, выбрав панель Helpers → элемент Physics → параметр Shapes (Visualizer должен быть включен).

SphereСфера#

A sphere is the simplest and the fastest shape, as it has only one parameter: a radius. Continuous collision detection is available for spherical shapes. Therefore, passing through other objects even when moving at a high speed is avoided. сфера - самая простая и быстрая форма, поскольку у нее только один параметр: радиус. Для сферических форм доступно постоянное обнаружение столкновений. Следовательно, избегается прохождение через другие объекты даже при движении с высокой скоростью.

Using the spherical shape for any arbitrary mesh ensures that its collisions will always be detected. Использование сферической формы для любой произвольной сетки гарантирует, что ее столкновения всегда будут обнаруживаться.

Sphere shapes

For a shape to fit your object, you can adjust the Radius of the sphere. Чтобы форма соответствовала вашему объекту, вы можете настроить Радиус сферы.

Radius of the Sphere

CapsuleКапсула#

A capsule is also a very fast collision shape with continuous collision detection available. Capsules are convenient for approximation of elongated objects (pillars, etc.) as well as humanoid characters, because it allows them to go up and down the stairs smoothly, without stumbling at each step (if the steps are not too high). It also ensures that character's limb will not get stuck somewhere unexpectedly. Капсула также представляет собой форму очень быстрого столкновения с возможностью непрерывного обнаружения столкновения. Капсулы удобны для приближения удлиненных предметов (колонн и т. Д.), А также персонажей-гуманоидов, поскольку позволяют им плавно подниматься и спускаться по лестнице, не спотыкаясь на каждой ступеньке (если ступеньки не слишком высокие). Это также гарантирует, что конечность персонажа не застрянет где-нибудь неожиданно.

Capsule shapes

For a shape to fit your object, you can adjust the Radius and the Height of the capsule. Чтобы форма соответствовала вашему объекту, вы можете настроить радиус и высоту капсулы.

Height and Radius of the Capsule

CylinderЦилиндр#

A cylinder can be used to approximate elongated shapes with flat ends (e.g. a shafts, pylons, etc.). It is similar to a box shape. Цилиндр можно использовать для приближения удлиненных форм с плоскими концами (например, валов, пилонов и т. д.). Он похож на форму коробки.

Cylinder shapes

For a shape to fit your object, you can adjust the Radius and the Height of the cylinder. Чтобы форма соответствовала вашему объекту, вы можете отрегулировать радиус и высоту цилиндра.

Height and Radius of the Cylinder

BoxКуб#

A box is a cuboid shape which can be used for approximation of volume of various objects. it is suitable for walls, doors, stairs, parts of mechanisms, car bodies, and many other things. The length of a box shape in each dimension can be chosen arbitrarily. Куб можно использовать для аппроксимации объема различных объектов. подходит для отделки стен, дверей, лестниц, деталей механизмов, кузовов автомобилей и многого другого. Длину формы коробки в каждом измерении можно выбрать произвольно.

Box shapes

For a shape to fit your object, you can adjust the size of the box along each axis: Size X, Size Y, Size Y. Чтобы форма соответствовала вашему объекту, вы можете отрегулировать размер поля по каждой оси: Size X, Size Y, Size Y.

Size of the Box

Convex HullВыпуклая оболочка (Convex hull)#

Convex hull is the slowest of all shapes and is used for objects having complex geometry. The created shape will always be convex, that is, holes and cavities of the mesh are ignored when generating a convex hull. Instead, they are included into the shape volume. Convex shape is the smallest shape that can enclose vertices of the approximated mesh. Convex hull - самая медленная из всех форм и используется для объектов сложной геометрии. Созданная форма всегда будет выпуклой, то есть отверстия и полости сетки игнорируются при создании выпуклой оболочки. Вместо этого они включены в объем формы. Выпуклая форма - это наименьшая форма, которая может охватывать вершины приближенной сетки.

Convex shapes

To generate a convex hull specify an approximation error value: Для создания выпуклой оболочки укажите значение ошибки аппроксимации:

Convex shape

The Approximation error parameter makes it possible to reduce the number of vertices of the created shape. Simple and rough convex hulls with small number of vertices are processed faster, therefore, it is recommended to keep the number of vertices as low as possible. Параметр Approximation error позволяет уменьшить количество вершин создаваемой формы. Простые и грубые выпуклые оболочки с небольшим количеством вершин обрабатываются быстрее, поэтому рекомендуется сохранять количество вершин как можно меньшим.

  • By the value of 0, the shape precisely duplicates the mesh; the whole volume of it is enclosed. При значении 0 форма точно дублирует сетку; весь его объем прилагается.
  • The higher the value, the less vertices there are in the created shape, but the more details are skipped. Чем выше значение, тем меньше вершин в созданной форме, но тем больше деталей пропускается.
Zero Approximation Error
Approximation error = 0 Ошибка аппроксимации = 0
    Higher value of Approximation Error
Approximation error = 0.1 Ошибка аппроксимации = 0,1

AutogeneratedАвтогенерируемая форма#

To approximate a complex concave object and exclude cavities from its volume, use a set of autogenerated convex hulls. Чтобы приблизить сложный вогнутый объект и исключить полости из его объема, используйте набор автоматически сгенерированных выпуклых оболочек .

A complex concave object approximated by a single convex hull (left) and an autogenerated set of convex hulls (right) Сложный вогнутый объект, аппроксимированный единственной выпуклой оболочкой (слева) и автоматически сгенерированным набором выпуклой оболочки (справа)

To add an autogenerated set of shapes specify the following parameters: Чтобы добавить автоматически сгенерированный набор форм, укажите следующие параметры:

Convex shapes

Recursion depth determines the degree of mesh decomposition. If 0 or a negative value is provided, only one shape will be created. The higher the value, the more convex shapes are to be generated Recursion depth определяет степень декомпозиции сетки. Если указан 0 или отрицательное значение, будет создана только одна форма. Чем выше значение, тем больше выпуклых форм будет создано

Approximation error makes it possible to reduce the number of vertices of generated shapes. Simple and rough convex hulls with small number of vertices are processed faster, therefore, it is recommended to keep the number of vertices as low as possible. Approximation error позволяет уменьшить количество вершин генерируемых форм. Простые и грубые выпуклые оболочки с небольшим количеством вершин обрабатываются быстрее, поэтому рекомендуется сохранять количество вершин как можно меньшим.

  • By the value of 0, the shape precisely duplicates the mesh; the whole volume of it is enclosed. При значении 0 форма точно дублирует сетку; весь его объем прилагается.
  • The higher the value, the less vertices there are in the created shape, but the more details are skipped. Чем выше значение, тем меньше вершин в созданной форме, но тем больше деталей пропускается.

Merging threshold determines the volume threshold for merging convex shapes after decomposition and can be used to reduce the number of generated shapes: the higher the value, the less convex shapes are to be generated. Merging threshold определяет порог объема для слияния выпуклых форм после разложения и может использоваться для уменьшения количества генерируемых форм: чем выше значение, тем меньше выпуклые формы будут созданы.

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