GlobeRotation

Inherits Rotation

This Rotation orients the scene graph node in such a way that the y-axis points away from the provided globe, the x-axis points towards the globe’s southern pole and the z-axis points in a western direction. Using this rotation generally means using the GlobeTranslation to place the scene graph node at the same position for which the rotation is calculated.

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

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.

Double

In range: ( -90,90 )

No

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.

Double

In range: ( -180,180 )

No

Angle

A rotation angle (in degrees) that can be used to rotate the object around its own y-axis, which will be pointing out of the globe’s surface.

Double

Value of type ‘Double’

Yes

UseCamera

If this value is ‘true’, the latitute and longitude are updated each frame to match the location of the camera.

Boolean

Value of type ‘Boolean’

Yes

UseHeightmap

If set to true, the heightmap will be used when computing the surface normal. This means that the object will be rotated to lay flat on the surface at the given coordinate and follow the shape of the landscape.

Boolean

Value of type ‘Boolean’

Yes

Inherited members from Rotation

Name

Documentation

Type

Description

Optional

Type

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

String

Must name a valid Rotation type

No

TimeFrame

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

Table

TimeFrame

Yes

Asset Examples

UseCamera

This asset creates a rotation that places a coordinate axes on the surface of a planetary body. The rotation causes the coordinate axes to remain fixed to the surface of the globe. In this example, the rotation of the object will be updated based on the location of the camera. When loading this example, make sure to focus the camera on the Globe object for the follow-function to work.

In order for this feature to work properly, the coordinate axes need to be located at the same place as well, so this example also needs a GlobeTranslation applied, which in this case also updated based on the camera location.

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

This asset creates a rotation that places a coordinate axes on the surface of a planetary body. The rotation causes the coordinate axes to remain fixed to the surface of the globe.

In order for this feature to work properly, the coordinate axes need to be located at the same place as well, so this example also needs a GlobeTranslation applied.

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

This asset creates a rotation that places a coordinate axes on the surface of a planetary body. The rotation causes the coordinate axes to remain fixed to the surface of the globe. Additionally, the coordinate axes are rotated around the up-axis by a fixed amount.

In order for this feature to work properly, the coordinate axes need to be located at the same place as well, so this example also needs a GlobeTranslation applied.

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