GlobeTranslation

Inherits Translation

Places the scene graph node at a specific location relative to another scene graph node. The position is identified via the longitude, latitude, and altitude parameters. If the provided scene graph node is a globe, the positions correspond to the native coordinate frame of that object. If it is a node without a renderable or a non-globe renderable, the latitude/longitude grid used is the node’s interaction sphere.

This class is useful in conjunction with the GlobeRotation rotation to orient a scene graph node away from the center of the body.

If the UseCamera value is set, the object’s position automatically updates based on the current camera location.

Members

Name

Documentation

Type

Description

Optional

Globe

The node on which the longitude/latitude is specified. If the node is a globe, the correct height information for the globe is used. Otherwise, the position is specified based on the longitude and latitude on the node’s interaction sphere

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

Type

The type of translation that is described in this element. The available types of translations depend on the configuration of the application and can be written to disk on application startup into the FactoryDocumentation.

String

Must name a valid Translation type

No

Altitude

The altitude in meters. If the ‘UseHeightmap’ property is ‘true’, this is an offset from the actual surface of the globe. If not, this is an offset from the reference ellipsoid. The default value is 0.0.

Double

Value of type ‘Double’

Yes

Latitude

The latitude of the location on the globe’s surface. The value can range from -90 to 90, with negative values representing the southern hemisphere of the globe. The default value is 0.0.

Double

In range: ( -90, 90)

Yes

Longitude

The longitude of the location on the globe’s surface. The value can range from -180 to 180, with negative values representing the western hemisphere of the globe. The default value is 0.0.

Double

In range: ( -180, 180)

Yes

TimeFrame

The time frame in which this Translation is applied. If the in-game time is outside this range, no translation will be applied.

Table

TimeFrame

Yes

UseCamera

If this value is ‘true’, the lat and lon are updated to match the camera.

Boolean

Value of type ‘Boolean’

Yes

UseCameraAltitude

If this value is ‘true’, the altitude is updated to match the camera.

Boolean

Value of type ‘Boolean’

Yes

UseHeightmap

If this value is ‘true’, the altitude specified in ‘Altitude’ will be treated as an offset from the heightmap. Otherwise, it will be an offset from the globe’s reference ellipsoid. The default value is ‘false’.

Boolean

Value of type ‘Boolean’

Yes

Inherited members from Translation

Name

Documentation

Type

Description

Optional

Type

The type of translation that is described in this element. The available types of translations depend on the configuration of the application and can be written to disk on application startup into the FactoryDocumentation.

String

Must name a valid Translation type

No

TimeFrame

The time frame in which this Translation is applied. If the in-game time is outside this range, no translation will be applied.

Table

TimeFrame

Yes

Asset Examples

Fixed Height

This asset creates a translation that places coordinate axes on the surface of a planetary body with a fixed height to the reference surface of the globe. Note that this examples only the position of the coordinate axes, but leaves the orientation unchanged, causing their rotation to be inherited from the parent node.

 1-- The example needs a `RenderableGlobe` with a height map as a parent to function
 2local Globe = {
 3  Identifier = "GlobeTranslation_Example_FixedHeight_Globe",
 4  Renderable = {
 5    Type = "RenderableGlobe"
 6  },
 7  GUI = {
 8    Name = "GlobeTranslation - Fixed Height (Globe)",
 9    Path = "/Examples"
10  }
11}
12
13local Node = {
14  Identifier = "GlobeTranslation_Example_FixedHeight",
15  Parent = "GlobeTranslation_Example_FixedHeight_Globe",
16  Transform = {
17    Translation = {
18      Type = "GlobeTranslation",
19      Globe = "GlobeTranslation_Example_FixedHeight_Globe",
20      Latitude = 20.0,
21      Longitude = -45.0,
22      Altitude = 2.0
23    }
24  },
25  Renderable = {
26    Type = "RenderableCartesianAxes"
27  },
28  GUI = {
29    Name = "GlobeTranslation - Fixed Height",
30    Path = "/Examples"
31  }
32}
33
34
35asset.onInitialize(function()
36  openspace.addSceneGraphNode(Globe)
37  openspace.addSceneGraphNode(Node)
38end)
39
40asset.onDeinitialize(function()
41  openspace.removeSceneGraphNode(Node)
42  openspace.removeSceneGraphNode(Globe)
43end)
Adaptive Height

This asset creates a translation that places coordinate axes on the surface of a planetary body while adjusting to the existing height map on the globe. Note that this examples only the position of the coordinate axes, but leaves the orientation unchanged, causing their rotation to be inherited from the parent node.

 1-- The example needs a `RenderableGlobe` with a height map as a parent to function
 2local layer = asset.require("scene/solarsystem/planets/earth/layers/heightlayers/blue_marble_height")
 3local Globe = {
 4  Identifier = "GlobeTranslation_Example_AdaptiveHeight_Globe",
 5  Renderable = {
 6    Type = "RenderableGlobe",
 7    Layers = {
 8      HeightLayers = { layer.layer }
 9    }
10  },
11  GUI = {
12    Name = "GlobeTranslation - Adaptive Height (Globe)",
13    Path = "/Examples"
14  }
15}
16
17local Node = {
18  Identifier = "GlobeTranslation_Example_AdaptiveHeight",
19  Parent = "GlobeTranslation_Example_AdaptiveHeight_Globe",
20  Transform = {
21    Translation = {
22      Type = "GlobeTranslation",
23      Globe = "GlobeTranslation_Example_AdaptiveHeight_Globe",
24      Latitude = 20.0,
25      Longitude = -45.0,
26      UseHeightmap = true
27    }
28  },
29  Renderable = {
30    Type = "RenderableCartesianAxes"
31  },
32  GUI = {
33    Name = "GlobeTranslation - Adaptive Height",
34    Path = "/Examples"
35  }
36}
37
38
39asset.onInitialize(function()
40  openspace.addSceneGraphNode(Globe)
41  -- The layer is designed for a globe with Earth scale. So we need to scale it down for
42  -- it to make sense for this example
43  openspace.setPropertyValueSingle("Scene.GlobeTranslation_Example_AdaptiveHeight_Globe.Renderable.Layers.HeightLayers.Earth_Bluemarble_Height.Enabled", true)
44  enspace.setPropertyValueSingle("Scene.GlobeTranslation_Example_AdaptiveHeight_Globe.Renderable.Layers.HeightLayers.Earth_Bluemarble_Height.Settings.Multiplier", 1.9)
45  openspace.setPropertyValueSingle("Scene.GlobeTranslation_Example_AdaptiveHeight_Globe.Renderable.Layers.HeightLayers.Earth_Bluemarble_Height.Settings.Gamma", 0.16)
46
47  openspace.addSceneGraphNode(Node)
48end)
49
50asset.onDeinitialize(function()
51  openspace.removeSceneGraphNode(Node)
52  openspace.removeSceneGraphNode(Globe)
53end)
Basic

This asset creates a translation that places coordinate axes on the surface of a planetary body. Note that this examples only the position of the coordinate axes, but leaves the orientation unchanged, causing their rotation to be inherited from the parent node.

 1-- The example needs a `RenderableGlobe` as a parent to function
 2local Globe = {
 3  Identifier = "GlobeTranslation_Example_Globe",
 4  Renderable = {
 5    Type = "RenderableGlobe"
 6  },
 7  GUI = {
 8    Name = "GlobeTranslation - Basic (Globe)",
 9    Path = "/Examples"
10  }
11}
12
13local Node = {
14  Identifier = "GlobeTranslation_Example",
15  Parent = "GlobeTranslation_Example_Globe",
16  Transform = {
17    Translation = {
18      Type = "GlobeTranslation",
19      Globe = "GlobeTranslation_Example_Globe",
20      Latitude = 20.0,
21      Longitude = -45.0
22    }
23  },
24  Renderable = {
25    Type = "RenderableCartesianAxes"
26  },
27  GUI = {
28    Name = "GlobeTranslation - Basic",
29    Path = "/Examples"
30  }
31}
32
33
34asset.onInitialize(function()
35  openspace.addSceneGraphNode(Globe)
36  openspace.addSceneGraphNode(Node)
37end)
38
39asset.onDeinitialize(function()
40  openspace.removeSceneGraphNode(Node)
41  openspace.removeSceneGraphNode(Globe)
42end)