Files
OpenSpace/data/assets/examples/approachevents.asset
Emma Broman 8a42657deb Feature/examples naming (#3305)
* Update name and path format of examples that follow the new structure
* Fix a broken (updated) property name in an example
* Make other examples' GUI paths more consistent
* Put them all in the Examples folder
2024-06-13 10:42:00 +02:00

66 lines
1.5 KiB
Lua

local sun = asset.require("scene/solarsystem/sun/transforms")
local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
local model = asset.resource({
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 = "Event Model",
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.action.registerAction(GenericAction)
openspace.addSceneGraphNode(Model)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Model)
openspace.action.removeAction(GenericAction)
end)