Files
OpenSpace/data/assets/examples/renderable/renderablenodearrow/nodearrow.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

40 lines
1.2 KiB
Lua

-- Basic
-- This example shows an arrow pointing from one scene graph node in the direction of
-- another. Here, it points from Earth to Mars.
--
-- Note that the arrows are generated as objects in 3D space and need to have a size
-- that is suitable for the scene graph nodes they refer to. Here it is set based on
-- the size of the Earth.
local earth = asset.require("scene/solarsystem/planets/earth/earth")
local mars = asset.require("scene/solarsystem/planets/mars/mars")
local Node = {
Identifier = "RenderableNodeArrow_Example",
-- Parent to the start node, so that when we focus on the arrow this is where we end up
Parent = earth.Earth.Identifier,
Renderable = {
Type = "RenderableNodeArrow",
StartNode = earth.Earth.Identifier,
EndNode = mars.Mars.Identifier,
-- How far away from the start node should the arrow start (meters)
Offset = 2 * 6371000.0,
-- How long should the arrow be (meters)
Length = 5 * 6371000.0,
-- How wide should the arrow be (meters)
Width = 900000.0
},
GUI = {
Name = "RenderableNodeArrow - Basic",
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(Node)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Node)
end)