Unigine::Plugins::IG::Entity Class
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to- Sim
SDK edition to use it.
You should upgrade to
Header: | #include <plugins/UnigineIG.h> |
Entity Class
Enums
STATE#
Name | Description |
---|---|
STATE_INACTIVE = 0 | The entity is inactive. |
STATE_ACTIVE = 1 | The entity is active. |
STATE_DESTROYED = 2 | The entity is destroyed. |
CLAMP#
CLAMP_HEIGHT_MODE#
ANIMATION_DIRECTION#
Name | Description |
---|---|
ANIMATION_DIRECTION_FORWARD = 0 | Forward direction of the entity animation playback. |
ANIMATION_DIRECTION_BACKWARD = 1 | Backward direction of the entity animation playback. |
ANIMATION_LOOP#
Name | Description |
---|---|
ANIMATION_LOOP_ONESHOT = 0 | Oneshot mode of the entity animation playback. |
ANIMATION_LOOP_CONTINUOUS = 1 | Continuous mode of the entity animation playback. |
ANIMATION_STATE#
COORDINATE_SYSTEM#
Members
long long getID ( ) const#
Returns the unique ID of the entity instance.Return value
Entity ID.Ptr<Node> getNode ( ) const#
Returns the node assigned to the entity.Return value
Node assigned to the entity.Ptr<NodeReference> getNodeReference ( ) const#
Returns the node reference assigned to the entity.Return value
NodeReference assigned to the entity.void setGeoPosition ( const Math::dvec3& position, double timestamp ) #
Sets the entity position in geo-coordinates (lat, lon, alt).Arguments
- const Math::dvec3& position - New geo-coordinates of entity position to be set.
- double timestamp - Timestamp, indicating the time when entity position in geo-coordinates is to be set.
Math::dvec3 getGeoPosition ( ) const#
Returns the current entity position in geo-coordinates (lat, lon, alt).Return value
Entity position coordinates.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 Math::dvec3& offset, double timestamp ) #
Sets the entity position offset at the specified time.Arguments
- const Math::dvec3& offset - Position offset to be set for the entity.
- double timestamp - Timestamp, indicating the time when position offset is to be set.
Math::dvec3 getPositionOffset ( ) const#
Returns the current entity position offset.Return value
Current entity position offset.void setType ( long long id ) #
Sets the type of the entity. Entity type ID is defined in the entity definition section of the IG configuration file as follows:<entity_types>
<entity id="111" name="b52">
</entity>
</entity_types>
Arguments
- long long id - Entity type to be set. 0 removes the entity from the scene.
long long 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:<entity_types>
<entity id="111" name="b52">
</entity>
</entity_types>
Return value
Entity type.long long 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 id - Entity state to be set.
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 isCollision ( ) 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.long long 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 clamp - Ground/Ocean Clamp parameter value.
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 height_mode - Clamp height mode parameter value.
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.Math::dvec3 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::ANIMATION_DIRECTION animation_direction ) #
Sets the entity's animation playback direction.Arguments
- Entity::ANIMATION_DIRECTION animation_direction - Direction of the entity's animation playback.
Entity::ANIMATION_DIRECTION getAnimationDirection ( ) const#
Returns the current entity's animation playback direction.Return value
Direction of the entity's animation playback.void setAnimationLoop ( Entity::ANIMATION_LOOP animation_loop ) #
Sets the entity's animation playback mode.Arguments
- Entity::ANIMATION_LOOP animation_loop - Mode of the entity's animation playback.
Entity::ANIMATION_LOOP getAnimationLoop ( ) const#
Returns the current entity's animation playback mode.Return value
Mode of the entity's animation playback.void setAnimationState ( Entity::ANIMATION_STATE animation_state ) #
Sets the entity's animation playback state.Arguments
- Entity::ANIMATION_STATE animation_state - State of the entity's animation playback.
Entity::ANIMATION_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::COORDINATE_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::COORDINATE_SYSTEM animation_state - Coordinate system used for extrapolation.
Entity::COORDINATE_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::dvec3& linear, const Math::vec3& angular_deg ) #
Sets linear and angular velocity for the entity.Arguments
- const Math::dvec3& linear - Linear velocity vector to be set.
- const Math::vec3& angular_deg - Angular velocity vector (roll, pitch, yaw), in degrees per second.
Math::dvec3 getLinearVelocity ( ) const#
Returns the linear velocity of the entity.Return value
Linear velocity vector.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::dvec3& linear, const Math::vec3& angular_deg ) #
Sets linear and angular acceleration for the entity.Arguments
- const Math::dvec3& linear - Linear acceleration vector to be set.
- const Math::vec3& angular_deg - Angular acceleration vector (roll, pitch, yaw), in degrees per second.
Math::dvec3 getLinearAcceleration ( ) const#
Returns the linear acceleration of the entity.Return value
Linear acceleration vector.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.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:
<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 identifierbool 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:
<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.bool isPrespawned ( ) const#
Last update:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)