This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
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
Content Creation
Content Optimization
Materials
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::Plugins::IG::CollisionSegment 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 segments that are assigned to entities and used for collision detection.

Notice
IG plugin must be loaded.

A collision detection segment is a line segment along which collision testing is performed by the IG. When a collision detection segment intersects a polygon, the IG registers a collision by sending the corresponding notification.

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

The segment is defined by specifying the locations of its endpoints with respect to the associated entity’s body coordinate system. Figure below illustrates five segments defined for an aircraft.

Collision detection volumes are tested segment-to-polygon. An entity will not perform collision detection segment testing against its own geometry.

If an entity is destroyed, all collision detection segments defined for that entity will also be destroyed.

CollisionSegment Class

Members


int getID ( ) const#

Returns the ID of the collision segment.

Return value

Collision segment ID.

Entity * getEntity ( ) const#

Returns the entity to which the collision segment is assigned.

Return value

Entity to which the collision segment is assigned.

bool isEnable ( ) const#

Returns a value indicating if the collision segment is enabled.

Return value

true if the collision segment is enabled; otherwise, false

void setEnable ( bool value ) #

Enables or disables the collision segment.

Arguments

  • bool value - true to enable the collision segment; false - to disable it.

void setStartPoint ( const vec3 & point ) #

Sets the coordinates of the start point of the collision segment.

Arguments

  • const vec3 & point - Coordinates of the start point of the collision segment, in the coordinate system of the entity.

const vec3 & getStartPoint ( ) const#

Returns the current coordinates of the start point of the collision segment.

Return value

Coordinates of the start point of the collision segment, in the coordinate system of the entity.

void setEndPoint ( const vec3 & point ) #

Sets the coordinates of the end point of the collision segment.

Arguments

  • const vec3 & point - Coordinates of the end point of the collision segment, in the coordinate system of the entity.

const vec3 & getEndPoint ( ) const#

Returns the current coordinates of the end point of the collision segment.

void setMaterialMask ( int mask ) #

Sets the material mask for the collision segment. This parameter specifies the environmental and cultural features to be included in or excluded from consideration for collision testing.

Arguments

  • int mask - Integer representing a bit mask, each bit of which represents a range of material code values. Setting that bit to 1 will cause the IG to register hits with materials within the corresponding range.

int getMaterialMask ( ) const#

Gets the material mask for the collision segment. This parameter specifies the environmental and cultural features to be included in or excluded from consideration for collision testing.

Return value

Integer representing a bit mask, each bit of which represents a range of material code values. Setting that bit to 1 will cause the IG to register hits with materials within the corresponding range.

void setCollisionDetectedCallback ( Unigine::CallbackBase * func ) #

Sets a callback on detecting a collision with the collision segment. This function can be used to define specific actions to be performed when a collision with the segment is detected. The signature of the callback function is as follows:
void(CollisionSegment *segment , ObjectPtr object, WorldIntersectionPtr wi)
Source code (C++)
/// callback function to be called when a collision with the collision segment is detected
void my_callback(CollisionSegment *segment , ObjectPtr object, WorldIntersectionPtr wi)
{
	// your code
}

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

Arguments

Last update: 2021-04-29
Build: ()