RenderableTravelSpeed

Inherits Renderable

Visualizes a certain travel speed using a line that moves at the provided speed from a start object to a target. The start position will be set from the Parent of this scene graph node, and the end position is set from the provided Target scene graph node. Per default, the speed is set to the speed of light.

The length of the travelling line is set based on the travel speed and can be used to show more information related to the distance traveled. For example, a length of 1 shows how far an object would move over a duration of one second based on the selected speed.

The indicator will move from the parent to the target node based on the currently set simulation time and the set TravelSpeed. That is, increasing the simulation speed makes the indicator move faster.

Members

Name

Documentation

Type

Description

Optional

Target

The identifier of the scene graph node to target with the speed indicator. The speed indicator will travel from the parent node to this scene graph node.

Identifier

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

No

Color

An RGB color for the line.

Color3

Value of type ‘Color3’

Yes

FadeLength

The length of the faded tail of the speed indicator, given in seconds. The length of the tail will be computed as the speed times this value. For example, a value of 1 will make it as long as the distance it would travel over one second. A linear fade will be applied over this distance to create the tail.

Double

Greater than: 0

Yes

IndicatorLength

The length of the speed indicator line, given in seconds. The length will be computed as the speed times this value. For example, a value of 1 will make it as long as the distance it would travel over one second with the specified speed.

Double

Greater than: 0

Yes

LineWidth

This value specifies the line width.

Double

Greater than: 0

Yes

TravelSpeed

A value for how fast the speed indicator should travel, in meters per second. The default value is the speed of light.

Double

Greater than: 0

Yes

Inherited members from Renderable

Name

Documentation

Type

Description

Optional

DimInAtmosphere

Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere.

Boolean

Value of type ‘Boolean’

Yes

Enabled

Determines whether this object will be visible or not.

Boolean

Value of type ‘Boolean’

Yes

Opacity

This value determines the opacity of this renderable. A value of 0 means completely transparent.

Double

In range: ( 0, 1)

Yes

RenderBinMode

A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step.

String

In list { Background, Opaque, PreDeferredTransparent, Overlay, PostDeferredTransparent, Sticker }

Yes

Tag

A single tag or a list of tags that this renderable will respond to when setting properties.

Table, or String

Value of type ‘Table’, or Value of type ‘String’

Yes

Type

The type of the renderable.

String

Value of type ‘String’

Yes

Asset Examples

Indicator Length and Width

This example creates a light speed indicator where the length and width of the line have been adjusted for the indicator to be more visible across the large distance from Earth to Mars. The line will move according to the speed of light.

 1local earthAsset = asset.require("scene/solarsystem/planets/earth/globe")
 2local marsAsset = asset.require("scene/solarsystem/planets/mars/globe")
 3
 4local Node = {
 5  Identifier = "RenderableTravelSpeed_Example_LengthAndWidth",
 6  Parent = earthAsset.Earth.Identifier,
 7  Renderable = {
 8    Type = "RenderableTravelSpeed",
 9    Target = marsAsset.Mars.Identifier,
10    -- Length in seconds, where 1 second = distance light travels in 1 second
11    IndicatorLength = 60.0,
12    -- Increase line width for visibility
13    LineWidth = 5.0
14  },
15   GUI = {
16    Name = "RenderableTravelSpeed - Indicator Length and Width",
17    Path = "/Examples",
18    Description = [[
19      A light speed indicator from Earth to Mars. The indicator's length corresponds to
20      60 seconds of travel at the speed of light.
21    ]]
22  }
23}
24
25
26asset.onInitialize(function()
27  openspace.addSceneGraphNode(Node)
28end)
29
30asset.onDeinitialize(function()
31  openspace.removeSceneGraphNode(Node)
32end)
Light Speed Indicator

This example creates a speed indicator; a line that travels with the speed of light from the parent node (Earth) to the target node (the Moon). By default, the length of the line is set to match the distance traveled over 1 second.

 1local earthAsset = asset.require("scene/solarsystem/planets/earth/globe")
 2local moonAsset = asset.require("scene/solarsystem/planets/earth/moon/globe")
 3
 4local Node = {
 5  Identifier = "RenderableTravelSpeed_Example",
 6  Parent = earthAsset.Earth.Identifier,
 7  Renderable = {
 8    Type = "RenderableTravelSpeed",
 9    Target = moonAsset.Moon.Identifier
10  },
11   GUI = {
12     Name = "RenderableTravelSpeed - Light Speed Indicator",
13    Path = "/Examples"
14  }
15}
16
17
18asset.onInitialize(function()
19  openspace.addSceneGraphNode(Node)
20end)
21
22asset.onDeinitialize(function()
23  openspace.removeSceneGraphNode(Node)
24end)
Custom Travel Speed

This example creates a speed indicator; a line that moves with a given speed from the parent node (Earth) to the target node (Jupiter). The travel speed is here set to 1 light-hour per second.

 1local earthAsset = asset.require("scene/solarsystem/planets/earth/globe")
 2local jupiterAsset = asset.require("scene/solarsystem/planets/jupiter/globe")
 3
 4local Node = {
 5  Identifier = "RenderableTravelSpeed_Example_TravelSpeed",
 6  Parent = earthAsset.Earth.Identifier,
 7  Renderable = {
 8    Type = "RenderableTravelSpeed",
 9    Target = jupiterAsset.Jupiter.Identifier,
10    TravelSpeed = 1.07925285e9, -- 1 light-hour in meters
11
12    -- Length in seconds, where 1 second = distance traveled in 1 second at the set
13    -- travel speed
14    IndicatorLength = 60,
15    -- Increase line width for visibility
16    LineWidth = 5.0
17
18  },
19   GUI = {
20    Name = "RenderableTravelSpeed - Light-hour Speed Indicator",
21    Path = "/Examples",
22    Description = [[
23      A speed indicator from Earth to Jupiter, moving at 1 light-hour per second. The
24      indicator's length corresponds to 60 seconds of travel at the set travel speed.
25    ]]
26  }
27}
28
29
30asset.onInitialize(function()
31  openspace.addSceneGraphNode(Node)
32end)
33
34asset.onDeinitialize(function()
35  openspace.removeSceneGraphNode(Node)
36end)