This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
VR Development
Double Precision Coordinates
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
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
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.

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

Properties

int MaterialMask#

The 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.

int ID#

The ID of the collision segment.

vec3 EndPoint#

The coordinates of the end point of the collision segment.

vec3 StartPoint#

The coordinates of the start point of the collision segment.

bool Enabled#

The a value indicating if the collision segment is enabled.

Entity Entity#

The entity to which the collision segment is assigned.

Members


IntPtr AddOnCollisionDetectedCallback ( OnCollisionDetectedDelegate func ) #

Adds a callback function to be called when a collision with the collision segment is detected. 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 must be as follows:
Source code (C#)
void(CollisionSegment segment , Object object, WorldIntersection wi)

You can set a callback function as follows:

Source code (C#)
AddOnCollisionDetectedCallback((seg, obj, wi) => collision_callback_function_name(seg, obj, wi));

Example: Setting a collision detected callback for a collision segment of an entity

Source code (C#)
class SomeClass
{
	/*...*/

	/// callback function to be called when a collision with the collision segment is detected
	private void on_position(CollisionSegment segment , Object object, WorldIntersection wi)
	{
		// insert your code handling collision event here
	}

	private void RegisterCallback()
	{
		// adding "my_callback" to be called when a collision with the segment is detected
		ig_manager.GetEntity(entity_id).GetCollisionSegment(segment_id).AddOnCollisionDetectedCallback((seg, obj, wi) => collision_callback_function_name(seg, obj, wi));
	}
	
	/*...*/
}

Arguments

  • OnCollisionDetectedDelegate func - Callback function with the following signature: void OnCollisionDetectedDelegate(CollisionSegment segment, Object object, WorldIntersection wi)

Return value

ID of the last added collision detected callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool RemoveOnCollisionDetectedCallback ( IntPtr id ) #

Removes the specified callback from the list of collision detected callbacks.

Arguments

  • IntPtr id - Collision detected callback ID obtained when adding it.

Return value

True if the collision detected callback with the given ID was removed successfully; otherwise false.

void ClearOnCollisionDetectedCallbacks ( ) #

Clears all added collision detected callbacks.
Last update: 2023-12-19
Build: ()