mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-11 22:20:47 -06:00
Introduce the ability to navigate using an anchor and aim. Example use: Set spacecraft as anchor and planet as aim to always look down at a planet, while followin the spacecraft in its orbit.
86 lines
2.9 KiB
Plaintext
86 lines
2.9 KiB
Plaintext
local assetHelper = asset.require('util/asset_helper')
|
|
local sceneHelper = asset.require('util/scene_helper')
|
|
|
|
-- Specifying which other assets should be loaded in this scene
|
|
asset.require('spice/base')
|
|
assetHelper.requestAll(asset, 'scene/solarsystem/sun')
|
|
asset.require('scene/solarsystem/planets')
|
|
asset.require('scene/solarsystem/planets/jupiter/minor_moons')
|
|
asset.require('scene/solarsystem/planets/saturn/minor_moons')
|
|
asset.require('scene/solarsystem/planets/uranus/minor_moons')
|
|
asset.require('scene/solarsystem/planets/neptune/inner_moons')
|
|
asset.require('scene/solarsystem/planets/neptune/irregular_prograde_moons')
|
|
asset.require('scene/solarsystem/planets/neptune/irregular_retrograde_moons')
|
|
asset.request('scene/digitaluniverse/stars')
|
|
asset.request('scene/digitaluniverse/milkyway')
|
|
asset.require('scene/solarsystem/missions/voyager/voyager1')
|
|
asset.require('scene/solarsystem/missions/voyager/voyager2')
|
|
|
|
-- Load default key bindings applicable to most scenes
|
|
asset.require('util/default_keybindings')
|
|
asset.require('util/default_dashboard')
|
|
asset.require('util/default_joystick')
|
|
|
|
asset.require('util/webgui')
|
|
|
|
local VoyagerAsset = asset.require('scene/solarsystem/missions/voyager/voyager1')
|
|
|
|
assetHelper.registerDashboardItems(asset, {
|
|
{
|
|
Type = "DashboardItemDistance",
|
|
Identifier = "Voyager1Distance",
|
|
GuiName = "Voyager 1 - Earth Distance",
|
|
SourceType = "Node",
|
|
SourceNodeName = "Voyager_1",
|
|
DestinationType = "Node",
|
|
DestinationNodeName = "Earth"
|
|
},
|
|
{
|
|
Type = "DashboardItemDistance",
|
|
Identifier = "Voyager2Distance",
|
|
GuiName = "Voyager 2 - Earth Distance",
|
|
SourceType = "Node",
|
|
SourceNodeName = "Voyager_2",
|
|
DestinationType = "Node",
|
|
DestinationNodeName = "Earth"
|
|
}
|
|
})
|
|
|
|
asset.onInitialize(function ()
|
|
openspace.time.setTime("1977 SEP 10 12:00:00")
|
|
|
|
openspace.setDefaultGuiSorting()
|
|
|
|
sceneHelper.setDeltaTimeKeys({
|
|
1, 5, 10, 20, 40, 90, 360, 720, 2880, 14400,
|
|
28800, 57600, 115200, 230400, 460800, 921600, 1843200, 3686400, 7372800, 14745600
|
|
})
|
|
|
|
openspace.markInterestingNodes({
|
|
"Earth", "Voyager 1", "Voyager 2", "Jupiter", "Saturn", "Uranus", "Neptune"
|
|
})
|
|
|
|
openspace.addVirtualProperty(
|
|
"BoolProperty",
|
|
"Show Trails",
|
|
"*Trail.Renderable.Enabled",
|
|
"Disable or enable all trails of the scene at the same time",
|
|
true,
|
|
nil,
|
|
nil
|
|
)
|
|
|
|
openspace.navigation.setCameraState({
|
|
Anchor = VoyagerAsset.Voyager_1.Identifier,
|
|
Position = { 526781518487.171326, 257168309890.072144, -1381125204152.817383 },
|
|
Rotation = { -0.106166, 0.981574, -0.084545, 0.134513 },
|
|
})
|
|
end)
|
|
|
|
asset.onDeinitialize(function ()
|
|
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
|
|
openspace.removeInterestingNodes({
|
|
"Earth", "Voyager 1", "Voyager 2", "Jupiter", "Saturn", "Uranus", "Neptune"
|
|
})
|
|
end)
|