This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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 Optimization
Materials
Art Samples
Tutorials

GeodeticsPlugin

警告
本文介绍的功能在 Community SDK 版本中不可用。
您应该升级到 Engineering / Sim SDK版本才能使用它。

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.在 Unigine 中创建的世界使用笛卡尔坐标,而现实世界的模拟器通常使用地理空间数据。为了使这两个 Universe 匹配,UNIGINE 提供了 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.该插件允许将 GPS 纬度、经度和高度坐标转换为 X、Y 和 Z,反之亦然。该解决方案适用于平坦矩形地形区域和行星状 Terrain Global

See also也可以看看#

Launching GeodeticsPlugin启动测地学插件#

To use GeodeticsPlugin, specify the extern_plugin command line option on the application start-up:要使用 GeodeticsPlugin,请在应用程序启动时指定 extern_plugin 命令行选项:

命令行
main_x64 -extern_plugin "Geodetics"

Using GeodeticsPlugin使用 GeodeticsPlugin#

Here is an example code that illustrates how to position an object in a world using geodetic coordinates:下面的示例代码说明了如何使用大地坐标在世界中定位对象:

源代码 (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);
}
最新更新: 2021-09-17
Build: ()