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

Unigine::Plugins::IG::Entity 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 represents the IG Entity interface.

Notice
IG plugin must be loaded.

Entity Class

Enums

STATE#

NameDescription
INACTIVE = 0The entity is inactive.
ACTIVE = 1The entity is active.
DESTROYED = 2The entity is destroyed.

CLAMP#

NameDescription
NO_CLAMP = 0Altitude clamping for entity is disabled.
NON_CONFORMAL = 1Altitude parameter specifies an offset of the entity above the ground level.
CONFORMAL = 2Altitude parameter specifies an offset of the entity above the sea level.

CLAMP_HEIGHT_MODE#

NameDescription
RELATIVE = 0Clamp height mode that makes the entity to be clamped to the ground and the height be calculated from the ground.
IGNORE = 1Clamp height mode that makes the entity to be clamped to the ground and the height be ignored.

ANIM_DIR#

NameDescription
FORWARD = 0Forward direction of the entity animation playback.
BACKWARD = 1Backward direction of the entity animation playback.

ANIM_LOOP#

NameDescription
ONESHOT = 0Oneshot mode of the entity animation playback.
CONTINUOUS = 1Continuous mode of the entity animation playback.

ANIM_STATE#

NameDescription
STOP = 0Stop entity animation playback.
PAUSE = 1Pause entity animation playback.
PLAY = 2Start entity animation playback.
CONTINUE = 3Resume entity animation playback.

COORD_SYSTEM#

NameDescription
WORLD = 0If the reference coordinate system is set to this value, and the entity is a top-level (non-child) entity, the velocity and acceleration are defined relative to the database. Linear velocity and acceleration describe a path along and above the surface of the geoid. Angular velocity and acceleration describe a rotation relative to a reference plane. If the entity is a child entity, the velocity and acceleration are defined relative to the parent’s local coordinate system.
LOCAL = 1If the reference coordinate system is set to this value, the velocity and acceleration are defined relative to the entity’s local coordinate system.

Members


int64_t getID ( ) #

Returns the unique ID of the entity instance.

Return value

Entity ID.

const NodePtr & getNode ( ) #

Returns the node assigned to the entity.

Return value

Node assigned to the entity.

const NodeReferencePtr & getNodeReference ( ) #

Returns the node reference assigned to the entity.

Return value

NodeReference assigned to the entity.

void setGeoPosition ( const dvec3 & position, double timestamp ) #

Sets the entity position in geo-coordinates (lat, lon, alt).

Arguments

  • const dvec3 & position - New geo-coordinates of entity position to be set.
  • double timestamp

dvec3 getGeoPosition ( ) const#

Returns the current entity position in geo-coordinates (lat, lon, alt).

Return value

Entity position coordinates.
Notice
Geo-coordinates will be returned if there is no parent entity assigned, otherwise — local coordinates will be returned.

void setRotationEuler ( const Math::vec3 & euler, double timestamp ) #

Sets the entity rotation at the specified time.

Arguments

  • const Math::vec3 & euler - Entity rotation euler angles to set.
  • double timestamp - Timestamp, indicating the time when rotation is to be set.

Math::vec3 getRotationEuler ( ) const#

Returns the current entity rotation euler angles.

Return value

Entity rotation euler angles.

void setPositionOffset ( const Vec3 & offset, double timestamp ) #

Sets the entity position offset at the specified time.

Arguments

  • const Vec3 & offset - Position offset to be set for the entity.
  • double timestamp - Timestamp, indicating the time when position offset is to be set.

Vec3 getPositionOffset ( ) const#

Returns the current entity position offset.

Return value

Current entity position offset.

void setType ( int64_t id ) #

Sets the type of the entity. Entity type ID is defined in the entity definition section of the IG configuration file as follows:
Source code (XML)
<entity_types>
	<entity id="111" name="b52">
	</entity>
</entity_types>
Setting the type to 0 removes the entity from the scene.

Arguments

  • int64_t id - Entity type to be set. 0 removes the entity from the scene.

int64_t getType ( ) const#

Returns the type of the entity. Entity type ID is defined in the entity definition section of the IG configuration file as follows:
Source code (XML)
<entity_types>
	<entity id="111" name="b52">
	</entity>
</entity_types>

Return value

Entity type.

int64_t getInternalType ( ) const#

Returns the internal type of the entity.

Return value

Internal entity type.

void setState ( Entity::STATE id ) #

Sets the state of the entity.

Arguments

Entity::STATE getState ( ) const#

Returns the current entity state.

Return value

Current entity state.

void setCollision ( bool enabled ) #

Sets the value indicating if collision detecton shall be enabled for the entity.

Arguments

  • bool enabled - true to enable collision detecton for the entity; false — to disable.

bool getCollision ( ) const#

Returns the value indicating if collision detecton shall be enabled for the entity.

Return value

Collision Detection Enable parameter value. true collision detecton for the entity shall be enabled; false — collision detecton for the entity shall be enabled.

void setParent ( Entity * entity ) #

Attaches the entity as a child to the specified parent entity.

Arguments

  • Entity * entity - Parent entity.

void unparent ( ) #

Detaches the entity from its parent.

int64_t getParentID ( ) const#

Returns the ID of the entity parent.

Return value

Entity parent ID.

int getAttachState ( ) const#

Returns the value of the Attach State parameter. It specifies whether the entity is be attached as a child to a parent.

Return value

Attach State parameter value. 1 the entity shall be or remain attached to the entity specified by the Parent ID parameter; 0 — the entity shall be detached from its parent.

void setAlpha ( int byte_value ) #

Sets the alpha value, that determines transparency of entity geometry.

Arguments

  • int byte_value - Alpha value to be set.

int getAlpha ( ) const#

Returns the current alpha value, that determines transparency of entity geometry.

Return value

Alpha value.

void setInheritAlpha ( bool enabled ) #

Sets the value indicating if the entity uses the alpha value of its parent.

Arguments

  • bool enabled - true the entity shall use the alpha value of its parent; false — the entity shall use its own alpha value.

bool isInheritAlpha ( ) const#

Returns the value indicating if the entity uses the alpha value of its parent.

Return value

true if the entity uses the alpha value of its parent; otherwise, false.

void setGroundClamp ( Entity::CLAMP clamp ) #

Sets the value of the Ground/Ocean Clamp parameter.

Arguments

Entity::CLAMP getGroundClamp ( ) const#

Returns the value of the Ground/Ocean Clamp parameter.

Return value

Ground/Ocean Clamp parameter value.

void setGroundClampHeightMode ( Entity::CLAMP_HEIGHT_MODE height_mode ) #

Sets the value of the clamp height mode parameter used for clamping. By default, the Ground Clamp Height Mode is set to RELATIVE — the entity is clamped to the ground and the height is calculated from the ground. With the mode set to IGNORE, the entity is clamped to the ground and the height is ignored.

Arguments

Entity::CLAMP_HEIGHT_MODE getGroundClampHeightMode ( ) const#

Returns the value of the clamp height mode parameter used for clamping. By default, the Ground Clamp Height Mode is set to RELATIVE — the entity is clamped to the ground and the height is calculated from the ground. With the mode set to IGNORE, the entity is clamped to the ground and the height is ignored.

Return value

Clamp height mode parameter value.

const Vec3 & getGroundClampPoint ( ) const#

Returns the current ground clamping point coordinates for the entity. Clamping is performed relative to the ground and sea level.

void setAnimationDirection ( Entity::ANIM_DIR animation_direction ) #

Sets the entity's animation playback direction.

Arguments

  • Entity::ANIM_DIR animation_direction - Direction of the entity's animation playback.

Entity::ANIM_DIR getAnimationDirection ( ) const#

Returns the current entity's animation playback direction.

Return value

Direction of the entity's animation playback.

void setAnimationLoop ( Entity::ANIM_LOOP animation_loop ) #

Sets the entity's animation playback mode.

Arguments

Entity::ANIM_LOOP getAnimationLoop ( ) const#

Returns the current entity's animation playback mode.

Return value

Mode of the entity's animation playback.

void setAnimationState ( Entity::ANIM_STATE animation_state ) #

Sets the entity's animation playback state.

Arguments

Entity::ANIM_STATE getAnimationState ( ) const#

Returns the current entity's animation playback state.

Return value

State of the entity's animation playback.

void setInterpolation ( bool id ) #

Sets a value indicating if interpolation and extrapolation are enabled.

Arguments

  • bool id - true to enable interpolation and extrapolation; false — to disable.

bool isInterpolation ( ) const#

Returns a value indicating if interpolation and extrapolation are enabled.

Return value

true if interpolation and extrapolation are enabled; otherwise, false.

void clearInterpolationData ( ) #

Clears all interpolation data for the entity.

void setExtrapolationCoordSystem ( Entity::COORD_SYSTEM animation_state ) #

Sets the reference coordinate system to which the linear and angular velocity and acceleration are applied. If the reference coordinate system is set to WORLD, and the entity is a top-level (non-child) entity, the velocity and acceleration are defined relative to the database. Linear velocity and acceleration describe a path along and above the surface of the geoid. Angular velocity and acceleration describe a rotation relative to a reference plane. If the entity is a child entity, the velocity and acceleration are defined relative to the parent’s local coordinate system. If the reference coordinate system is set to LOCAL, the velocity and acceleration are defined relative to the entity’s local coordinate system.

Arguments

Entity::COORD_SYSTEM getExtrapolationCoordSystem ( ) const#

Returns the current reference coordinate system to which the linear and angular velocity and acceleration are applied. If the reference coordinate system is set to WORLD, and the entity is a top-level (non-child) entity, the velocity and acceleration are defined relative to the database. Linear velocity and acceleration describe a path along and above the surface of the geoid. Angular velocity and acceleration describe a rotation relative to a reference plane. If the entity is a child entity, the velocity and acceleration are defined relative to the parent’s local coordinate system. If the reference coordinate system is set to LOCAL, the velocity and acceleration are defined relative to the entity’s local coordinate system.

Return value

Extrapolation coordinate system.

void setVelocity ( const Math::Vec3 & linear, const Math::vec3 & angular_deg ) #

Sets linear and angular velocity for the entity.

Arguments

  • const Math::Vec3 & linear - Linear velocity vector to be set.
  • const Math::vec3 & angular_deg - Angular velocity vector (roll, pitch, yaw), in degrees per second.

const Math::Vec3 & getLinearVelocity ( ) const#

Returns the linear velocity of the entity.

Return value

Linear velocity vector.

const Math::vec3 & getAngularVelocity ( ) const#

Returns the angular velocity of the entity.

Return value

Angular velocity vector (roll, pitch, yaw), in degrees per second.

void setAcceleration ( const Math::Vec3 & linear, const Math::vec3 & angular_deg ) #

Sets linear and angular acceleration for the entity.

Arguments

  • const Math::Vec3 & linear - Linear acceleration vector to be set.
  • const Math::vec3 & angular_deg - Angular acceleration vector (roll, pitch, yaw), in degrees per second.

const Math::Vec3 & getLinearAcceleration ( ) const#

Returns the linear acceleration of the entity.

Return value

Linear acceleration vector.

const Math::vec3 & getAngularAcceleration ( ) const#

Returns the angular acceleration of the entity.

Return value

Angular acceleration vector (roll, pitch, yaw), in degrees per second.

Component * getComponent ( int id, bool auto_create ) #

Returns the interface of the specified component.

Arguments

  • int id - ID of the component.
  • bool auto_create - true to automatically create the component with the specified ID if it doesn't exist yet; false - to return nullptr in case the component doesn't exist.

Return value

Component interface if it exists, or nullptr otherwise.

Vector < IG::Component * > getComponents ( ) const#

Returns the list of all components associated with the entity.

ArticulatedPart * getArticulatedPart ( int id, bool auto_create ) #

Returns the interface of the specified articulated part.

Arguments

  • int id - ID of the articulated part.
  • bool auto_create - true to automatically create the articulated part with the specified ID if it doesn't exist yet; false - to return nullptr in case the articulated part doesn't exist.

Return value

Articulated part interface if it exists, or nullptr otherwise.

Vector < IG::ArticulatedPart * > getArticulatedParts ( ) const#

Returns the list of all articulated parts associated with the entity.

CollisionSegment * getCollisionSegment ( int id, bool auto_create ) #

Returns the interface of the specified collision segment.

Arguments

  • int id - ID of the collision segment.
  • bool auto_create - true to automatically create the collision segment with the specified ID if it doesn't exist yet; false - to return nullptr in case the collision segment doesn't exist.

Return value

Collision segment interface if it exists, or nullptr otherwise.

Vector < IG::CollisionSegment * > getCollisionSegments ( ) const#

Returns the list of all collision segments associated with the entity.

CollisionVolume * getCollisionVolume ( int id, bool auto_create ) #

Returns the interface of the specified collision volume.

Arguments

  • int id - ID of the collision volume.
  • bool auto_create - true to automatically create the collision volume with the specified ID if it doesn't exist yet; false - to return nullptr in case the collision volume doesn't exist.

Return value

Collision volume interface if it exists, or nullptr otherwise.

Vector < IG::CollisionVolume * > getCollisionVolumes ( ) const#

Returns the list of all collision volumes associated with the entity.

const Unigine::Vector< Ptr<Node> > & getObjects ( ) const#

Returns the vector of all nodes, that constitute the entity.

Return value

Vector of nodes, that constitute the entity.

int64_t getEntityTypeFromDIS ( uint8_t kind, uint8_t domain, uint16_t country, uint8_t cat, uint8_t subcat, uint8_t spec, uint8_t extra ) #

Returns the entity type identifier (defined in the entity definition section) based on the given arguments. This method is used to convert the entity's ID from DIS type to the IG type.
You can also set the type using a DIS-style ID:
Source code (XML)
<entity_types>
	<entity id="1.2.222.4.14.0.0" name="vehicle">
	</entity>
</entity_types>

Arguments

  • uint8_t kind - Entity kind
  • uint8_t domain - Domain
  • uint16_t country - Country
  • uint8_t cat - Category
  • uint8_t subcat - Sub Category
  • uint8_t spec - Specific
  • uint8_t extra - Extra

Return value

Entity type identifier

bool getDISTypeFromEntityType ( int64_t entity_type, uint8_t & kind, uint8_t & domain, uint16_t & country, uint8_t & cat, uint8_t & subcat, uint8_t & spec, uint8_t & extra ) #

Returns the DIS-style entity type identifier (by setting values for the given arguments: kind, domain, etc.) based on the specified entity type ID used in the IG (see the entity definition section). This method is used to convert the entity's ID from IG type to the DIS type.
Entity type can be specified using a DIS-style ID:
Source code (XML)
<entity_types>
	<entity id="1.2.222.4.14.0.0" name="vehicle">
	</entity>
</entity_types>

Arguments

  • int64_t entity_type - Entity type identifier.
  • uint8_t & kind - Kind
  • uint8_t & domain - Domain
  • uint16_t & country - Country
  • uint8_t & cat - Category
  • uint8_t & subcat - Sub Category
  • uint8_t & spec - Specific
  • uint8_t & extra - Extra

Return value

true, if the entity type ID conversion from IG to DIS is successfull, otherwise false.

int64_t getEntityIDFromDISID ( uint16_t app, uint16_t id ) #

Returns the result of entity ID conversion from DIS to IG. In case of DIS an entity is identified by a pair: Application ID + Entity ID (Site ID is ignored by IG).

Arguments

  • uint16_t app - Application ID.
  • uint16_t id - Entity ID used in DIS application.

Return value

Entity ID used in IG.

void getDISIDFromEntityID ( int64_t entity_id, uint16_t & app, uint16_t & id ) #

Converts entity ID from IG to DIS and puts the result to variables specified via app and id arguments. In case of DIS an entity is identified by a pair: Application ID + Entity ID (Site ID is ignored by IG).

Arguments

  • int64_t entity_id - Entity ID used in IG.
  • uint16_t & app - Application ID used in DIS.
  • uint16_t & id - Entity ID used in DIS.

const char * getTypeName ( ) const#

Returns the name of the entity type (defined in the entity definition section).

Return value

Entity type name.
Last update: 2021-02-17