asset.require('./base') local assetHelper = asset.require('util/asset_helper') local sceneHelper = asset.require('util/scene_helper') local propertyHelper = asset.require('util/property_helper') asset.require('scene/solarsystem/missions/osirisrex/osirisrex') -- Custom Keybindings local Keybindings = { { Key = "a", Command = "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'OsirisRex')" .. "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');" .. "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)", Documentation = "Sets the focus of the camera on 'OsirisRex'.", Name = "Focus on OsirisRex", GuiPath = "/Missions/Osiris Rex", Local = false }, { Key = "s", Command = "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'BennuBarycenter')" .. "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');" .. "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)", Documentation = "Sets the focus of the camera on 'Bennu'", Name = "Focus on Bennu", GuiPath = "/Missions/Osiris Rex", Local = false }, -- TODO -- Maybe these can be fixed later -- { -- Key = "F6", -- Command = "openspace.printInfo('Set time: Launch');openspace.time.setTime('2016 SEP 08 23:05:00');", -- Documentation = "Sets the time to the launch of Osiris Rex.", -- Name = "Set launch time", -- GuiPath = "/Missions/Osiris Rex", -- Local = false -- }, -- { -- Key = "F7", -- Command = "openspace.printInfo('Set time: Gravity Assist');openspace.time.setTime('2017 SEP 22 15:00:00');", -- Documentation = "Sets the time to the Earth gravity assist.", -- Name = "Set Earth gravity assist time", -- GuiPath = "/Missions/Osiris Rex", -- Local = false -- }, { Key = "F8", Command = "openspace.printInfo('Set time: Approach');openspace.time.setTime('2018-SEP-11 21:31:01.183');", Documentation = "Sets the time to the approach at Bennu.", Name = "Set Bennu approach time", GuiPath = "/Missions/Osiris Rex", Local = false }, { Key = "F9", Command = "openspace.printInfo('Set time: Preliminary Survey');openspace.time.setTime('2018-NOV-20 01:13:12.183');", Documentation = "Sets the time to the preliminary survey of Bennu.", Name = "Set Bennu survey time", GuiPath = "/Missions/Osiris Rex", Local = false }, { Key = "F10", Command = "openspace.printInfo('Set time: Orbital B');openspace.time.setTime('2019-APR-08 10:35:27.186');", Documentation = "Sets the time to the orbital B event.", Name = "Set orbital B event time", GuiPath = "/Missions/Osiris Rex", Local = false }, { Key = "F11", Command = "openspace.printInfo('Set time: Recon');openspace.time.setTime('2019-MAY-25 03:50:31.195');", Documentation = "Sets the time to the recon event.", Name = "Set recon event time", GuiPath = "/Missions/Osiris Rex", Local = false }, { Key = "q", Command = propertyHelper.invert('Scene.SunMarker.Renderable.Enabled'), Documentation = "Toggles the visibility of the text marking the location of the Sun.", Name = "Toggle Sun marker", GuiPath = "/Missions/Osiris Rex", Local = false }, -- { -- Key = "e", -- Command = propertyHelper.invert('Scene.EarthMarker.Renderable.Enabled'), -- Documentation = "Toggles the visibility of the text marking the location of the Earth.", -- Name = "Toggle Earth marker", -- GuiPath = "/Missions/Osiris Rex", -- Local = false -- } } local OsirisRexAsset = asset.require('scene/solarsystem/missions/osirisrex/model') assetHelper.registerDashboardItems(asset, { { Type = "DashboardItemSpacing", Identifier = "OsirisRexSpacing", GuiName = "OSIRIS-REx Spacing", Spacing = 25 }, { Type = "DashboardItemDistance", Identifier = "OsirisRexBennuDistance", GuiName = "OSIRIS-REx Bennu Distance", SourceType = "Node", SourceNodeName = "OsirisRex", DestinationType = "Node", DestinationNodeName = "BennuBarycenter" }, { Type = "DashboardItemInstruments", Identifier = "OsirisRexInstruments", GuiName = "OSIRIS-REx Instruments", } }) asset.onInitialize(function () openspace.time.setTime("2018 10 30 23:00:00.500") sceneHelper.bindKeys(Keybindings) sceneHelper.setDeltaTimeKeys({ 1, 5, 10, 20, 40, 60, 120, 360, 540, 1080, 2160, 4320, 8640 }) openspace.markInterestingNodes({ "OsirisRex", "BennuBarycenter", "Earth" }) openspace.navigation.setNavigationState({ Anchor = OsirisRexAsset.OsirisRex.Identifier, Position = { 26974590199.661884, 76314608558.908020, -127086452897.101791 } }) end) asset.onDeinitialize(function () sceneHelper.unbindKeys(Keybindings) openspace.removeInterestingNodes({ "OsirisRex", "BennuBarycenter", "Earth" }) end)