IG::Manager 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 <UnigineIG.h> |
Manager Class
Members
IGConfig * getConfig ( ) #
Returns the IG configuration as an IGConfig class instance.Return value
IGConfig class instance containing IG configuration.bool loadDatabase ( int datatbase_id ) #
Loads the database with the specified ID and sets it to be used.Arguments
- int datatbase_id - ID of the database to be used.
Return value
true means that the database with the specified ID is loaded successfully; otherwise, false.int getCurrentDatabaseID ( ) #
Returns the identifier of the currently loaded world database stored in the IG configuration file (ig_config.xml).Return value
Identifier of the world database, or 0, if no world is loaded.int getDatabaseID ( const char * world_name ) #
Returns the identifier of the world database with the specified name stored in the IG configuration file (ig_config.xml).Arguments
- const char * world_name - World database name.
Return value
Identifier of the specified world database, or 0, if no world is loaded.const char * getDatabaseName ( int id ) #
Returns the name of the world database stored in the IG configuration file (ig_config.xml).Arguments
- int id - Identifier of the world database.
Return value
The world database name.bool isDatabaseLoaded ( ) #
Returns a value indicating if any database is currently loaded.Return value
true if any database is currently loaded; otherwise, false.SkyMap * getSkyMap ( ) #
Returns the interface of the sky map.Return value
Sky map interface.Meteo * getMeteo ( ) #
Returns the meteo interface.Return value
Meteo interface.SymbolsController * getSymbolsController ( ) #
Returns the interface of the symbols controller.Return value
Symbols controller interface.LightController * getLightController ( ) #
Returns the interface of the light controller.Return value
Light controller interface.void setCoordinateSystem ( int coord_system ) #
Sets the specified coordinate system to be used.Arguments
- int coord_system - Coordinate system to be set. One of the COORDINATE_SYSTEM::* values.
int getCoordinateSystem ( ) #
Returns the currently used coordinate system.Return value
Coordinate system currently used.Converter * getConverter ( ) #
Returns the converter interface.Return value
Converter interface.View * getView ( int view_id ) #
Returns the interface of the specified view.The specified view will be created, if it doesn't exist yet.
Arguments
- int view_id - ID of the view.
Return value
Pointer to the view interface.ViewGroup * getViewGroup ( int group_id ) #
Returns the interface of the specified view group.The specified view group will be created, if it doesn't exist yet.
Arguments
- int group_id - ID of the view group.
Return value
Pointer to the view group interface.Entity * getEntity ( int entity_id ) #
Returns the interface of the specified entity.The specified entity will be created, if it doesn't exist yet.
Arguments
- int entity_id - ID of the entity.
Return value
Pointer to the entity interface.void getEntities ( Unigine::Vector<Entity *> & entities_ret ) #
Fills the list of entities with all existing entities.Arguments
int isEntity ( int entity_id ) #
Returns a value indicating if an entity with the specified ID exists.Arguments
- int entity_id - ID of the entity.
Return value
1 if an entity with the specified ID exists; otherwise, 0.Entity * findEntity ( const Unigine::NodePtr & node ) #
Returns the interface of the entity represented by the specified node.Arguments
- const Unigine::NodePtr & node - Node for which an entity is to be found.
Return value
Pointer to the entity interface.int findEntityType ( const char * type_name ) #
Returns the ID of the entity type by its name. Entity type ID and name define the type of the entity to be used for a specific instance and are set in the entity definition section of the IG configuration file as follows:<entity_types>
<entity id="111" name="b52">
</entity>
</entity_types>
Arguments
- const char * type_name - Entity type name.
Return value
Entity type ID.int findComponentID ( int entity_type, const char * name ) #
Returns the ID of the component with the given name, which belongs to the specified entity type.Arguments
- int entity_type - Entity type ID.
Entity type ID is defined in the entity definition section of the IG configuration file.
- const char * name - Component name.
Return value
Component ID.int findArticulatedPartID ( int entity_type, const char * name ) #
Returns the identifier of an articulated part by its name and the type of the entity it belongs to, stored in the IG configuration file (ig_config.xml).Arguments
- int entity_type - Entity type identifier indicated in the IG configuration file (ig_config.xml).
- const char * name - Name of an articulated part indicated in the IG configuration file (ig_config.xml).
Return value
Identifier of an articulated part.void setPlayer ( int view_id ) #
Sets the view with the given ID as a current one.Arguments
- int view_id - ID of the view to be set.
void setInterpolation ( int enabled ) #
Sets a value indicating if interpolation and extrapolation should be enabled for the IG.Arguments
- int enabled - 1 to enable interpolation and extrapolation for the IG; 0 - to disable.
int isInterpolation ( ) #
Returns a value indicating if interpolation and extrapolation are enabled for the IG.Return value
1 if interpolation and extrapolation are enabled for the IG; otherwise, 0.void setInterpolationLerp ( int enabled ) #
Sets a value indicating if interpolation between the current and previous frames should be enabled for the IG to tackle the problem of lost packets between the IG and hosts.Arguments
- int enabled - 1 to enable interpolation between the current and previous frames for the IG; 0 - to disable.
int isInterpolationLerp ( ) #
Returns a value indicating if interpolation between the current and previous frames is enabled for the IG to tackle the problem of lost packets between the IG and hosts.Return value
1 if interpolation between the current and previous frames is enabled for the IG; otherwise, 0.void setInterpolationTime ( double current_time ) #
Sets the interpolation time value for the IG.Arguments
- double current_time - Current interpolation time value, in seconds.
double getInterpolationTime ( ) #
Returns the current interpolation time value for the IG.Return value
Interpolation time value, in seconds.void setInterpolationPeriod ( double period ) #
Sets the interpolation period value for the IG.Arguments
- double period - Interpolation period value, in seconds. The default value is 0.04.
double getInterpolationPeriod ( ) #
Returns the current interpolation period value for the IG.Return value
Interpolation period value, in seconds. The default value is 0.04.void setExtrapolationPeriod ( double period ) #
Sets the extrapolation period value for the IG.Arguments
- double period - Extrapolation period value, in seconds. The default value is 0.04.
int getExtrapolationPeriod ( ) #
Returns the current extrapolation period value for the IG.Return value
Extrapolation period value, in seconds. The default value is 0.2.void setInterpolationLerpFactor ( double current_time ) #
Sets the interpolation lerp factor value for the IG. The lower the value the smoother movement will be, but it will feel like objects move underwater or in a jelly, higher values result in higher positioning accuracy (objects positions will be closer to actual ones for the current frame), but objects will move with a noticeable jitter.Frame-to-frame interpolation mode must be enabled.
Arguments
- double current_time - Current interpolation lerp factor value, in seconds.
double getInterpolationLerpFactor ( ) #
Returns the current interpolation lerp factor value for the IG. The lower the value the smoother movement will be, but it will feel like objects move underwater or in a jelly, higher values result in higher positioning accuracy (objects positions will be closer to actual ones for the current frame), but objects will move with a noticeable jitter.Frame-to-frame interpolation mode must be enabled.
Return value
Interpolation lerp factor value.const Unigine::ObjectTerrainGlobalPtr & getTerrain ( ) #
Returns the currently used terrain object.Return value
Currently used terrain object.const Unigine::GeodeticPivotPtr & getGeodeticPivot ( ) #
Returns the geodetic pivot used to curve the terrain.Return value
Current geodetic pivot used to curve the terrain.int isTerrainCurved ( ) #
Check if the terrain is curved.Return value
1, if the terrain is curved, otherwise 0.void setTerrainIntersectionMask ( int mask ) #
Sets the intersection mask that is used to define the ground/landing surface.Arguments
- int mask - Intersection mask.
int getTerrainIntersectionMask ( ) #
Returns the intersection mask that is used to define the ground/landing surface.Return value
Intersection mask.bool getHatHot ( const Vec3 & geo_position, double & ret_hat, double & ret_hot, IGIntersection & ret_intersection ) #
Checks if there is anything in the given geodetic position and returns HAT/HOT as well as surface normal, exact object over which the request was made, intersected surface, world coordinates of the intersection point, etc. to the specified output variables.Arguments
- const Vec3 & geo_position - Geodetic position.
- double & ret_hat - Address for the return HAT value.
- double & ret_hot - Address for the return HOT value.
- IGIntersection & ret_intersection - Information on intersection at the given geodetic position, such as exact object over which the request was made, intersected surface, world coordinates of the intersection point, etc.
Return value
true, if there is anything in the given geodetic position, otherwise false.bool getIntersection ( const Vec3 & p0, const Vec3 & p1, int mask, Unigine::Vector<IGIntersection> & ret ) #
Checks if the ray with set points intersects with anything.Arguments
- const Vec3 & p0 - Ray origin.
- const Vec3 & p1 - Point along the ray.
- int mask - Intersection mask.
- Unigine::Vector<IGIntersection> & ret - Vector containing information on intersections.
Return value
1, if the ray intersects with anything, otherwise 0.Water * getWater ( ) #
Returns the interface of the water control.Return value
Water control interface.Unigine::Plugins::Syncker::Syncker * getSyncker ( ) #
Returns the Syncker Interface.Return value
Pointer to the Syncker::Syncker interface.Unigine::Plugins::Syncker::Master * getSynckerMaster ( ) #
Returns the Syncker Master Interface.Return value
Pointer to the Syncker::Master interface.Unigine::Plugins::Syncker::Slave * getSynckerSlave ( ) #
Returns the Syncker Slave Interface.Return value
Pointer to the Syncker::Slave interface.Ptr<Node> loadNode ( const char * file_path ) #
Loads a node from the specified file to the world on the Master and all Slaves. This is a network analogue of the loadNode() method of the World class.This is a safe analogue of the Syncker method loadNode() that has an internal check if this method runs on the master and if Syncker is running.
Arguments
- const char * file_path - Path to the *.node file.
Return value
Loaded node or nullptr if an error has occurred.void syncNode ( const Ptr<Node> & node, unsigned char sync_mask = ~0 ) #
Enables synchronization of parameters of the given node via the UDP protocol. Scene nodes are not synchronized by default, this method is used to add a particular node to the synchronization queue.This is a safe analogue of the Syncker method addSyncNode() that has an internal check if this method runs on the master and if Syncker is running. If this method is called on a slave, it does nothing.
Arguments
bool synckerCreate ( const Ptr<Node> & node ) #
Synchronizes creation of the given node on all Slaves. This method is to be called after node creation on the Master. It is recommended to use the loadNode() method whenever possible as this approach allows adding nodes of all types, unlike the synckerCreate() method that supports only a limited number of them.This is a safe analogue of the Syncker method createNode() that has an internal check if this method runs on the master and if Syncker is running. If this method is called on a slave, it does nothing.
Arguments
Return value
true if the node was created successfully; otherwise, false.void synckerDestroy ( const Ptr<Node> & node ) #
Synchronizes deletion of the given node (with all its children) on the Master and all Slaves.This is a safe analogue of the Syncker method deleteNode() that has an internal check if this method runs on the master and if Syncker is running. If this method is called on a slave, it does nothing.
Arguments
bool isSyncNode ( const Ptr<Node> & node ) #
Returns a value indicating if synchronization of the given node is enabled. Using this method you can quickly check if a node is monitored by the Syncker (node's states are dispatched to Slaves over the network).This is a safe analogue of the Syncker method isSyncNode() that has an internal check if this method runs on the master and if Syncker is running. If this method is called on a slave, it does nothing.
Arguments
Return value
true if synchronization of the given node is enabled; otherwise, false.int64_t getEntityType ( 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. Can be used to convert the entity's 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 checkEntityType ( int64_t entity_type ) #
Checks if the given entity type is supported by IG.Arguments
- int64_t entity_type - Entity type identifier
Return value
1, if the given entity type is supported, otherwise 0.void setCollisionVolumeDetectionCallback ( Unigine::CallbackBase * func ) #
Sets the callback function that is executed as soon as intersection with the collision volume is detected.Arguments
- Unigine::CallbackBase * func - Callback function
void setCollisionSegmentDetectionCallback ( Unigine::CallbackBase * func ) #
Sets the callback function that is executed as soon as intersection with the collision segment is detected.Arguments
- Unigine::CallbackBase * func - Callback function
void setCollisionVolumeMask ( int mask ) #
Sets a new collision volume mask for entities.Arguments
- int mask - New collision volume mask.
int getCollisionVolumeMask ( ) #
Returns the current collision volume mask for entities.Return value
Current collision volume mask for entities.void setFreeze ( bool value ) #
Sets a value indicating if execution of IG logic is temporarily put on hold (paused). This method can be useful for debugging.Arguments
- bool value - true - to put on hold (pause) execution of IG logic; false - to resume execution.
bool isFreeze ( ) #
Returns a value indicating if execution of IG logic is temporarily put on hold (paused).Return value
true, if execution of IG logic is temporarily put on hold (paused), otherwise false.void sendUserMessage ( uint8_t packet_code, const BlobPtr & send_message ) #
Sends user message from the master to a slave.Arguments
- uint8_t packet_code - Packet ID
- const BlobPtr & send_message - User message
void setOnUserMessageReceivedCallback ( uint8_t packet_code, Unigine::CallbackBase * callback ) #
Executes the callback function when the user message from the master is received.Arguments
- uint8_t packet_code - Packet ID
- Unigine::CallbackBase * callback - Callback function
Last update:
19.12.2020
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter