GPTranslation

Inherits Translation

Members

Name

Documentation

Type

Description

Optional

File

Specifies the filename of the general pertubation file

File

Value of type ‘File’

No

Format

A NORAD-style Two-Line element Orbit Mean-Elements Message in the KVN notation JPL’s Small Bodies Database The file format that is contained in the file

String

In list { TLE, OMM, SBDB }

No

Element

Specifies the element within the file that should be used in case the file provides multiple general pertubation elements. Defaults to 1.

Integer

Greater than: 0

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

 1local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
 2local coreKernels = asset.require("spice/core")
 3
 4
 5
 6local omm = asset.resource({
 7  Name = "Satellite OMM Data (Hubble)",
 8  Type = "UrlSynchronization",
 9  Identifier = "satellite_omm_data_hst",
10  Url = "https://www.celestrak.com/NORAD/elements/gp.php?CATNR=20580&FORMAT=kvn",
11  Filename = "hst.txt",
12  SecondsUntilResync = openspace.time.secondsPerDay()
13})
14
15
16local HubblePosition = {
17  Identifier = "HubblePosition",
18  Parent = transforms.EarthInertial.Identifier,
19  Transform = {
20    Translation = {
21      Type = "GPTranslation",
22      Observer = transforms.EarthInertial.Identifier,
23      File = omm .. "hst.txt",
24      Format = "OMM"
25    },
26    Rotation = {
27      Type = "SpiceRotation",
28      SourceFrame = coreKernels.Frame.Galactic,
29      DestinationFrame = coreKernels.Frame.J2000
30    }
31  },
32  Tag = { "earth_satellites", "hubble" },
33  GUI = {
34    Name = "Hubble Position",
35    Path = "/Solar System/Planets/Earth/Satellites/Hubble",
36    Focusable = false,
37    Hidden = true
38  }
39}
40
41local HubbleTrail = {
42  Identifier = "HubbleTrail",
43  Parent = transforms.EarthInertial.Identifier,
44  Renderable = {
45    Type = "RenderableTrailOrbit",
46    Translation = {
47      Type = "GPTranslation",
48      Observer = transforms.EarthInertial.Identifier,
49      File = omm .. "hst.txt",
50      Format = "OMM"
51    },
52    RenderBinMode = "PostDeferredTransparent",
53    Color = { 0.0, 0.902, 0.6 },
54    Fade = 1.5,
55    Resolution = 320
56  },
57  Tag = { "earth_satellites", "hubble" },
58  GUI = {
59    Name = "Hubble Trail",
60    Path = "/Solar System/Planets/Earth/Satellites/Hubble",
61    Focusable = false
62  }
63}
64
65
66asset.onInitialize(function()
67  local hubble = openspace.space.readKeplerFile(omm .. "hst.txt", "OMM")
68  HubbleTrail.Renderable.Period = hubble[1].Period / (60 * 60 * 24)
69
70  openspace.addSceneGraphNode(HubblePosition)
71  openspace.addSceneGraphNode(HubbleTrail)
72end)
73
74asset.onDeinitialize(function()
75  openspace.removeSceneGraphNode(HubbleTrail)
76  openspace.removeSceneGraphNode(HubblePosition)
77end)
78
79asset.export(HubblePosition)
80asset.export(HubbleTrail)
81
82
83
84asset.meta = {
85  Name = "Hubble Space Telescope Trail",
86  Description = "Position and Trail for Hubble Space Telescope, trail from Celestrak",
87  Author = "Dan Tell",
88  URL = "www.calacademy.org",
89  License = "CC-BY"
90}