mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 11:18:22 -05:00
65 lines
1.6 KiB
Lua
65 lines
1.6 KiB
Lua
local sun = asset.require("scene/solarsystem/sun/sun")
|
|
local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
|
|
|
|
local generic_action = {
|
|
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 = asset.syncedResource({
|
|
Name = "Animated Box",
|
|
Type = "HttpSynchronization",
|
|
Identifier = "animated_box",
|
|
Version = 1
|
|
})
|
|
|
|
local obj = {
|
|
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
|
|
},
|
|
PerformShading = true,
|
|
EnableFaceCulling = true
|
|
},
|
|
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",
|
|
Description = "",
|
|
}
|
|
}
|
|
|
|
asset.onInitialize(function()
|
|
openspace.action.registerAction(generic_action)
|
|
openspace.addSceneGraphNode(obj)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(obj)
|
|
openspace.action.removeAction(generic_action)
|
|
end)
|