diff --git a/data/assets/examples/renderable/renderabletravelspeed/travelspeed_appearance.asset b/data/assets/examples/renderable/renderabletravelspeed/travelspeed_appearance.asset new file mode 100644 index 0000000000..e8f650c0a7 --- /dev/null +++ b/data/assets/examples/renderable/renderabletravelspeed/travelspeed_appearance.asset @@ -0,0 +1,36 @@ +-- 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. + +local earthAsset = asset.require("scene/solarsystem/planets/earth/earth") +local marsAsset = asset.require("scene/solarsystem/planets/mars/mars") + +local Node = { + Identifier = "RenderableTravelSpeed_Example_LengthAndWidth", + Parent = earthAsset.Earth.Identifier, + Renderable = { + Type = "RenderableTravelSpeed", + Target = marsAsset.Mars.Identifier, + -- Length in seconds, where 1 second = distance light travels in 1 second + IndicatorLength = 60.0, + -- Increase line width for visibility + LineWidth = 5.0 + }, + GUI = { + Name = "RenderableTravelSpeed - Indicator Length and Width", + Path = "/Examples", + Description = [[ + A light speed indicator from Earth to Mars. The indicator's length corresponds to + 60 seconds of travel at the speed of light. + ]] + } +} + +asset.onInitialize(function() + openspace.addSceneGraphNode(Node) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(Node) +end) diff --git a/data/assets/examples/renderable/renderabletravelspeed/travelspeed_travelspeed.asset b/data/assets/examples/renderable/renderabletravelspeed/travelspeed_travelspeed.asset new file mode 100644 index 0000000000..5469117854 --- /dev/null +++ b/data/assets/examples/renderable/renderabletravelspeed/travelspeed_travelspeed.asset @@ -0,0 +1,40 @@ +-- 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. + +local earthAsset = asset.require("scene/solarsystem/planets/earth/earth") +local jupiterAsset = asset.require("scene/solarsystem/planets/jupiter/jupiter") + +local Node = { + Identifier = "RenderableTravelSpeed_Example_TravelSpeed", + Parent = earthAsset.Earth.Identifier, + Renderable = { + Type = "RenderableTravelSpeed", + Target = jupiterAsset.Jupiter.Identifier, + TravelSpeed = 1.07925285e9, -- 1 light-hour in meters + + -- Length in seconds, where 1 second = distance traveled in 1 second at the set + -- travel speed + IndicatorLength = 60, + -- Increase line width for visibility + LineWidth = 5.0 + + }, + GUI = { + Name = "RenderableTravelSpeed - Light-hour Speed Indicator", + Path = "/Examples", + Description = [[ + A speed indicator from Earth to Jupiter, moving at 1 light-hour per second. The + indicator's length corresponds to 60 seconds of travel at the set travel speed. + ]] + } +} + +asset.onInitialize(function() + openspace.addSceneGraphNode(Node) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(Node) +end) diff --git a/modules/space/rendering/renderabletravelspeed.cpp b/modules/space/rendering/renderabletravelspeed.cpp index d97faa43b6..81704b72af 100644 --- a/modules/space/rendering/renderabletravelspeed.cpp +++ b/modules/space/rendering/renderabletravelspeed.cpp @@ -105,6 +105,10 @@ namespace { // 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. struct [[codegen::Dictionary(RenderableTravelSpeed)]] Parameters { // [[codegen::verbatim(TargetInfo.description)]] std::string target [[codegen::identifier()]];