Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Программирование на C#
Рендеринг
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Setting Up Properties
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Узлы (Nodes)
Объекты (Objects)
Эффекты
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
UnigineScript
C#
Унифицированный язык шейдеров UUSL
File Formats
Rebuilding the Engine Tools
GUI
Двойная точность координат
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
Работа с контентом
Оптимизация контента
Материалы
Art Samples
Tutorials

GeodeticsPlugin

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Engineering / Sim SDK edition to use it.

A world created in Unigine uses Cartesian coordinates, whereas real-world simulators normally use geospatial data. To make these two universes match, UNIGINE provides GeodeticsPlugin.

This plugin allows translating GPS latitude, longitude, and altitude coordinates to X, Y, and Z and vice versa. The solution is applicable for both flat rectangular terrain areas and the planet-shaped Terrain Global.

See also#

Launching GeodeticsPlugin#

To use GeodeticsPlugin, specify the extern_plugin command line option on the application start-up:

Shell commands
main_x64 -extern_plugin "Geodetics"

Using GeodeticsPlugin#

Here is an example code that illustrates how to position an object in a world using geodetic coordinates:

Source code (C++)
#include <UnigineGeodeticsTransformer.h>


void init()
{
	auto transformer = GeodeticsTransformer::get();
	if (!transformer)
	{
		Log::warning("Can't get transformer\n");
		return 0;
	}

	int epsg_code = 3857; // EPSG Geodetic Parameter Datase code 
	dvec3 geodetic_origin = dvec3_zero;
	dvec3 original_geo_pos = dvec3(35.105580, -89.966775, 0.0);
	dvec3 world_pos, geo_pos;

	// setup projection
	transformer->setProjectionEpsg(epsg_code, geodetic_origin);
	// geodetic to world
	world_pos = transformer->geodeticToWorld(original_geo_pos).getTranslate();
	// world to geodetic
	geo_pos = transformer->worldToGeodetic(world_pos);

	Log::message("original geo_pos %f %f %f \n", original_geo_pos.x, original_geo_pos.y, original_geo_pos.z);
	Log::message("world_pos %f %f %f \n", world_pos.x, world_pos.y, world_pos.z);
	Log::message("geo_pos %f %f %f \n", geo_pos.x, geo_pos.y, geo_pos.z);
}
Last update: 20.11.2020