TimelineTranslation

Inherits Translation

Members

Name

Documentation

Type

Description

Optional

Keyframes

A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values that are valid Translation objects

Table

Table parameters

No

ShouldInterpolate

If this value is set to ‘true’, an interpolation is applied between the given keyframes. If this value is set to ‘false’, the interpolation is not applied.

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

Table parameters for Keyframes

A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values that are valid Translation objects

  • Optional: No

Name

Documentation

Type

Description

Optional

*

Table

Translation

No

Asset Examples

  1local trail = asset.require("./trail")
  2local marsTransforms = asset.require("scene/solarsystem/planets/mars/transforms")
  3local sun = asset.require("scene/solarsystem/sun/transforms")
  4local kernels = asset.require("./kernels")
  5local coreKernels = asset.require("spice/core")
  6
  7
  8
  9local models = asset.resource({
 10  Name = "Perseverance Model",
 11  Type = "HttpSynchronization",
 12  Identifier = "perseverance_models",
 13  Version = 2
 14})
 15
 16
 17local TranslationKeyframes = {
 18  ["1850 JAN 01 00:00:00"] = {
 19    Type = "SpiceTranslation",
 20    Target = kernels.ID.Perseverance,
 21    Observer = kernels.ID.Mars,
 22    Frame = kernels.Frame.Mars,
 23    FixedDate = "2020 JUL 17 13:56:43"
 24  },
 25  ["2020 JUL 17 13:56:42"] = {
 26    Type = "SpiceTranslation",
 27    Target = kernels.ID.Perseverance,
 28    Observer = kernels.ID.Mars,
 29    Frame = kernels.Frame.Mars,
 30    FixedDate = "2020 JUL 17 13:56:43"
 31  },
 32  ["2020 JUL 17 13:56:43"] = {
 33    Type = "SpiceTranslation",
 34    Target = kernels.ID.Perseverance,
 35    Observer = kernels.ID.Mars,
 36    Frame = kernels.Frame.Mars
 37  },
 38  ["2020 JUL 17 13:56:44"] = {
 39    Type = "SpiceTranslation",
 40    Target = kernels.ID.Perseverance,
 41    Observer = kernels.ID.Mars,
 42    Frame = kernels.Frame.Mars
 43  },
 44  ["2021 FEB 18 20:43:48"] = {
 45    Type = "SpiceTranslation",
 46    Target = kernels.ID.Perseverance,
 47    Observer = kernels.ID.Mars,
 48    Frame = kernels.Frame.Mars
 49  },
 50  ["2021 FEB 18 20:43:49"] = {
 51    Type = "SpiceTranslation",
 52    Target = kernels.ID.Perseverance,
 53    Observer = kernels.ID.Mars,
 54    Frame = kernels.Frame.Mars,
 55    FixedDate = "2021 FEB 18 20:43:48"
 56  }
 57}
 58
 59local PerseveranceNode = {
 60  Identifier = "PerseveranceNode",
 61  Parent = marsTransforms.MarsBarycenter.Identifier,
 62  Transform = {
 63    Translation = {
 64      Type = "SpiceTranslation",
 65      Target = kernels.ID.Mars,
 66      Observer = kernels.ID.MarsBarycenter
 67    },
 68    Rotation = {
 69      Type = "SpiceRotation",
 70      SourceFrame = kernels.Frame.Mars,
 71      DestinationFrame = coreKernels.Frame.Galactic
 72    }
 73  },
 74  GUI = {
 75    Name = "Perseverance Node",
 76    Path = "/Solar System/Missions/Perseverance",
 77    Hidden = true
 78  }
 79}
 80
 81-- Perseverance Model --
 82local Perseverance = {
 83  Identifier = "Perseverance",
 84  Parent = PerseveranceNode.Identifier,
 85  Transform = {
 86    Translation = {
 87      Type = "TimelineTranslation",
 88      Keyframes = TranslationKeyframes
 89    }
 90  },
 91  GUI = {
 92    Name = "Perseverance",
 93    Path = "/Solar System/Missions/Perseverance"
 94  }
 95}
 96
 97-- Perseverance Model --
 98local PerseveranceModel = {
 99  Identifier = "PerseveranceModel",
100  Parent = Perseverance.Identifier,
101  GUI = {
102    Name = "Perseverance Model",
103    Path = "/Solar System/Missions/Perseverance",
104    Hidden = true
105  }
106}
107
108-- Perseverance Model Instruments --
109local Body = {
110  Identifier = "Perseverance_body",
111  Parent = PerseveranceModel.Identifier,
112  Renderable = {
113    Type = "RenderableModel",
114    GeometryFile = models .. "Perseverance.obj",
115    LightSources = {
116      sun.LightSource,
117      {
118        Identifier = "Camera",
119        Type = "CameraLightSource",
120        Intensity = 0.5
121      }
122    },
123    RotationVector = { 19.19, 0.0, 348.08 }
124  },
125  GUI = {
126    Name = "Perseverance Model Body",
127    Path = "/Solar System/Missions/Perseverance/Model"
128  }
129}
130
131
132asset.onInitialize(function()
133  openspace.addSceneGraphNode(PerseveranceNode)
134  openspace.addSceneGraphNode(Perseverance)
135  openspace.addSceneGraphNode(PerseveranceModel)
136  openspace.addSceneGraphNode(Body)
137end)
138
139asset.onDeinitialize(function()
140  openspace.removeSceneGraphNode(Body)
141  openspace.removeSceneGraphNode(PerseveranceModel)
142  openspace.removeSceneGraphNode(Perseverance)
143  openspace.removeSceneGraphNode(PerseveranceNode)
144end)
145
146asset.export(PerseveranceNode)
147asset.export(Perseverance)
148asset.export(PerseveranceModel)
149asset.export(Body)