Unigine.Plugins.IG.SkyMap 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
This class is used to manage the Sun, the Moon, stars, day/night cycle for the IG.
IG plugin must be loaded.
The Celestial property is used to set the Sun and the Moon.
SkyMap Class
Properties
float StarfieldIntensity#
The star field intensity value.
float MoonIntensity#
The moon intensity value.
float SunIntensity#
The sun intensity value.
float Timezone#
The time zone currently used for the simulation in the UTC format.
bool ContinuousTime#
The a value indicating if the time of day is continuously updated by the image generator ore remains static.
Node MoonNode#
The a pointer to the node currently used to represent the Moon. Nodes for the Sun and the Moon can be assigned via the UnigineEditor.
bool MoonEnabled#
The a value indicating if the Moon is rendered or not.
Node SunNode#
The a pointer to the node currently used to represent the Sun. Nodes for the Sun and the Moon can be assigned via the UnigineEditor.
bool SunEnabled#
The a value indicating if the Sun is rendered or not.
bool StarfieldEnabled#
The a value indicating if the star field is rendered or not.
Members
void SetDateTime ( long time_posix, bool UTC = false ) #
Sets the time of the simulation.Arguments
- long time_posix - Time of the simulation to be set, number of seconds since January 1, 1970
- bool UTC - true to set this time as the Coordinated Universal Time (UTC +0), false — to set this time as the current local time.
void SetDateTime ( int sec, int min, int hour, int day, int month, int year, bool UTC = false ) #
Sets the current date and time.Arguments
- int sec - An integer between 0 and 59 to be set as seconds value.
- int min - An integer between 0 and 59 to be set as minutes value.
- int hour - An integer between 0 (midnight) and 23 (11 p.m.) local time to be set as hours value.
- int day - An integer between 1 and 31 to be set as day value.
- int month - An integer between 1 and 12 to be set as month value.
- int year - An integer to be set as year value.
- bool UTC - true to set this time as the Coordinated Universal Time (UTC +0), false — to set this time as the current local time.
long GetDateTime ( bool UTC = false ) #
Returns the current time of the simulation.Arguments
- bool UTC - true to return this time as the Coordinated Universal Time (UTC +0), false — to return this time as the current local time.
Return value
Current time of the simulation, number of seconds since January 1, 1970void ForceRefresh ( ) #
Refreshes the sky map according to its current settings. This method should be called after setting sky map's parameters to apply them. Sky map change callbacks are called on refresh.IntPtr AddOnTimeChangedCallback ( OnTimeChangedDelegate func ) #
Adds a callback function to be called when the sky map state changes. This function can be used to define specific actions to be performed when the sky map state changes. The signature of the callback function must be as follows:void(void)
You can set a callback function as follows:
AddOnTimeChangedCallback(() => time_changed_callback_function_name());
Example: Setting a time changed callback on changing sky map state.
class SomeClass
{
/*...*/
/// callback function to be called when a collision with the collision segment is detected
private void time_changed_callback_function_name()
{
// insert your code handling collision event here
}
// ...
// somewhere in code
void Init()
{
// adding "my_callback" to be called on changing sky map state
ig_manager.GetSkyMap().AddOnTimeChangedCallback(() => time_changed_callback_function_name());
}
/*...*/
}
Arguments
- OnTimeChangedDelegate func - Callback function with the following signature: void OnTimeChangedDelegate(void)
Return value
ID of the last added time changed callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.bool RemoveOnTimeChangedCallback ( IntPtr id ) #
Removes the specified callback from the list of time changed callbacks.Arguments
- IntPtr id - Time changed callback ID obtained when adding it.
Return value
True if the time changed callback with the given ID was removed successfully; otherwise false.void ClearOnTimeChangedCallbacks ( ) #
Clears all added time changed callbacks.Last update:
2022-10-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)