Files
OpenSpace/data/assets/examples/approachevents.asset
Alexander Bock 705c898ccd Asset File cleanup (#2713)
* Updating all assets to new coding style
* Cleaning up asset files
* Moving default_actions and default_keybindings files
* Changing procedural globes to explicitly specified globes
* Move Spice loading explicitly to the initialize part and also deinitialize
* Removing unused asset files
  * Removing asset_helper
  * Removing scale_model_helper asset
  * Removing script_scheduler_helper
  * Removing testing_keybindings
  * Remove procedural_globe
2023-05-28 17:23:20 +02:00

66 lines
1.5 KiB
Lua

local sun = asset.require("scene/solarsystem/sun/sun")
local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
local model = asset.syncedResource({
Name = "Animated Box",
Type = "HttpSynchronization",
Identifier = "animated_box",
Version = 1
})
local GenericAction = {
Identifier = "os.example.generic",
Name = "Generic example",
Command = [[
openspace.printInfo("Node: " .. args.Node)
openspace.printInfo("Transition: " .. args.Transition)
]],
Documentation = "Prints the argument information for camera transitions to the log",
GuiPath = "/Examples/Events",
IsLocal = true
}
local Model = {
Identifier = "ExampleEventModel",
Parent = transforms.EarthCenter.Identifier,
Transform = {
Translation = {
Type = "StaticTranslation",
Position = { 0.0, 11E7, 0.0 }
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = model .. "BoxAnimated.glb",
ModelScale = 1000,
LightSources = {
sun.LightSource
}
},
InteractionSphere = 900,
ApproachFactor = 50.0,
ReachFactor = 5.0,
OnApproach = { "os.example.generic" },
OnReach = { "os.example.generic" },
OnRecede = { "os.example.generic" },
OnExit = { "os.example.generic" },
GUI = {
Name = "Example Event Model",
Path = "/Example"
}
}
asset.onInitialize(function()
openspace.action.registerAction(GenericAction)
openspace.addSceneGraphNode(Model)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Model)
openspace.action.removeAction(GenericAction)
end)