This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Полезные советы
Программирование на C#
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Setting Up Properties
Освещение
Landscape Tool
Sandworm (Experimental)
Использование инструментов редактора для конкретных задач
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.

IG::CollisionVolume Class

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.
Header: #include <plugins/UnigineIG.h>

This class is used to manage collision volumes that are assigned to entities and used for collision detection.

Notice
IG plugin must be loaded.

A collision detection volume is a sphere or a cuboid through which collision testing is performed by the IG. When a collision detection volume passes through another collision volume, the IG registers a collision by sending the corresponding notification.

Notice
Collision detection testing is performed by the IG every frame.

A volume is defined by specifying its location, size, and orientation with respect to the associated entity’s body coordinate system. A sphere’s size is specified as a radius; a cuboid’s size is specified by its width, height, and depth.

Unlike collision detection segments, which are tested segment-to-polygon, collision detection volumes are tested volume-to-volume. Volumes associated with the same entity are not tested against each other.

CollisionVolume Class

Members


int getID ( ) #

Returns the ID of the collision volume.

Return value

Collision volume ID.

Entity * getEntity ( ) #

Returns the entity to which the collision volume is assigned.

Return value

Entity to which the collision volume is assigned.

void setEnable ( int value ) #

Enables or disables the collision volume.

Arguments

  • int value - 1 to enable the collision volume; 0 - to disable it.

int isEnable ( ) #

Returns a value indicating if the collision volume is enabled.

Return value

1 if the collision volume is enabled; otherwise, 0

void setPosition ( const vec3 & value ) #

Sets the coordinates of the center of the collision volume.

Arguments

  • const vec3 & value - Coordinates of the center of the collision volume, in the coordinate system of the entity.

vec3 getPosition ( ) #

Returns the current coordinates of the center of the collision volume.

Return value

Current coordinates of the center of the collision volume, in the coordinate system of the entity.

void setRotation ( const quat & value ) #

Sets the rotation of the cuboid-shaped collision volume. The rotation quaternion is obtained by converting NED euler rotation (roll, pitch, yaw) to a quaternion via the Converter::eulerNEDToRotation() method.

Arguments

  • const quat & value - Quaternion defining rotation of the cuboid-shaped collision volume.

quat getRotation ( ) #

Returns the current rotation of the cuboid-shaped collision volume. You can convert the obtained rotation quaternion to NED euler rotation (roll, pitch, yaw) via the Converter::rotationToEulerNED() method.

Return value

Quaternion defining rotation of the cuboid-shaped collision volume.

void setSize ( const vec3 & size ) #

Sets the size of the cuboid-shaped collision volume.

Arguments

  • const vec3 & size - Vector defining the size of the cuboid-shaped collision volume (depth, width, height). Each component is specified in meters.

void setRadius ( float radius ) #

Sets the radius of the spherical collision volume.

Arguments

  • float radius - Radius of the spherical collision volume, in meters.

void setCollisionDetectedCallback ( Unigine::CallbackBase * func ) #

Sets a callback on detecting a collision with the collision volume. This function can be used to define specific actions to be performed when a collision with the segment is detected.
Source code (C++)
/// callback function to be called when a collision with the collision volume is detected
void my_collision_callback()
{
	// your code
}

// ...
// somewhere in code
void SomeClass::init()
{
	// adding "my_collision_callback" to be called when a collision with the volume is detected
	ig_manager->getEntity(entity_id)->getCollisionVolume(volume_id)->setCollisionDetectedCallback(Unigine::MakeCallback( my_collision_callback );
}

Arguments

Last update: 24.11.2020
Build: ()