RenderableNodeArrow
Inherits Renderable
A RenderableNodeArrow can be used to create a 3D arrow pointing in the direction of one scene graph node to another.
The arrow will be placed at the StartNode
at a distance of the provided Offset
value. Per default, the Length
and Offset
of the arrow is specified in meters, but they may also be specified as a multiplier of the bounding sphere of the StartNode
. The look of the arrow can be customized to change the width and length of both the arrow body and head.
Members
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
The identifier of the node the arrow should point towards. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
The identifier of the node the arrow starts from. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
A multiplier for ambient lighting for the shading of the arrow. |
|
Greater or equal to: 0 |
Yes |
|
The length of the arrow head, given in relative value of the entire length of the arrow. For example, 0.1 makes the arrow head length be 10% of the full arrow length. |
|
Greater or equal to: 0 |
Yes |
|
A factor that is multiplied with the width, or the arrow itself, to determine the width of the base of the arrow head. |
|
Greater or equal to: 0 |
Yes |
|
The RGB color for the arrow. |
|
Value of type ‘Color3’ |
Yes |
|
A multiplier for diffuse lighting for the shading of the arrow. |
|
Greater or equal to: 0 |
Yes |
|
If true, the arrow direction is inverted so that it points to the start node instead of the end node. |
|
Value of type ‘Boolean’ |
Yes |
|
The length of the arrow, given either in meters or as a factor to be multiplied with the bounding sphere of the start node (if ‘UseRelativeLength’ is true). |
|
Greater or equal to: 0 |
Yes |
|
The distance from the center of the start node where the arrow starts. If ‘UseRelativeOffset’ is true, the value should be given as a factor to multiply with the bounding sphere of the node. Otherwise, the value is specified in meters. |
|
Value of type ‘Double’ |
Yes |
|
Determines whether shading should be applied to the arrow model. |
|
Value of type ‘Double’ |
Yes |
|
The number of segments that the shapes of the arrow are divided into. A higher number leads to a higher resolution and smoother shape. |
|
Greater or equal to: 3 |
Yes |
|
A multiplier for specular lighting for the shading of the arrow. |
|
Greater or equal to: 0 |
Yes |
|
Decides whether to use relative size for the length of the arrow. This means that the arrow length will be computed as the provided ‘Length’ value times the bounding sphere of the start node. If false, meters is used. |
|
Value of type ‘Boolean’ |
Yes |
|
Decides whether to use relative distances for the offset distance. This means that the offset distance will be computed as the provided ‘Offset’ value times the bounding sphere of the start node. If false, meters is used. |
|
Value of type ‘Boolean’ |
Yes |
|
The width of the arrow, in meters. |
|
Greater or equal to: 0 |
Yes |
Inherited members from Renderable
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere. |
|
Value of type ‘Boolean’ |
Yes |
|
Determines whether this object will be visible or not. |
|
Value of type ‘Boolean’ |
Yes |
|
This value determines the opacity of this renderable. A value of 0 means completely transparent |
|
In range: ( 0,1 ) |
Yes |
|
A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step. |
|
In list { Background, Opaque, PreDeferredTransparent, PostDeferredTransparent, Overlay } |
Yes |
|
A single tag or a list of tags that this renderable will respond to when setting properties |
|
Value of type ‘Table’, or Value of type ‘String’ |
Yes |
|
The type of the renderable. |
|
Value of type ‘String’ |
Yes |
Asset Examples
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.
1local earth = asset.require("scene/solarsystem/planets/earth/earth")
2local mars = asset.require("scene/solarsystem/planets/mars/mars")
3
4local Node = {
5 Identifier = "RenderableNodeArrow_Example",
6 -- Parent to the start node, so that when we focus on the arrow this is where we end up
7 Parent = earth.Earth.Identifier,
8 Renderable = {
9 Type = "RenderableNodeArrow",
10 StartNode = earth.Earth.Identifier,
11 EndNode = mars.Mars.Identifier,
12 -- How far away from the start node should the arrow start (meters)
13 Offset = 2 * 6371000.0,
14 -- How long should the arrow be (meters)
15 Length = 5 * 6371000.0,
16 -- How wide should the arrow be (meters)
17 Width = 900000.0
18 },
19 GUI = {
20 Name = "RenderableNodeArrow - Basic",
21 Path = "/Examples"
22 }
23}
24
25asset.onInitialize(function()
26 openspace.addSceneGraphNode(Node)
27end)
28
29asset.onDeinitialize(function()
30 openspace.removeSceneGraphNode(Node)
31end)
Relative Units for Offset and Length
This example shows an arrow pointing from one scene graph node in the direction of another, but where the size is specified using relative values (based on the bounding sphere of the start node). Here it points from Earth to the Moon. 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 start node, i.e. Earth.
1local earth = asset.require("scene/solarsystem/planets/earth/earth")
2local moon = asset.require("scene/solarsystem/planets/earth/moon/moon")
3
4local Node = {
5 Identifier = "RenderableNodeArrow_Example_Relative",
6 -- Parent to the start node, so that when we focus on the arrow this is where we end up
7 Parent = earth.Earth.Identifier,
8 Renderable = {
9 Type = "RenderableNodeArrow",
10 StartNode = earth.Earth.Identifier,
11 EndNode = moon.Moon.Identifier,
12 -- Use relative values for offset and length
13 UseRelativeOffset = true,
14 UseRelativeLength = true,
15 -- Specify relative values (times the size of Earth, in this case)
16 Offset = 2.0,
17 Length = 5.0,
18 -- Width is in meters
19 Width = 900000.0
20 },
21 GUI = {
22 Name = "RenderableNodeArrow - Relative Units",
23 Path = "/Examples"
24 }
25}
26
27asset.onInitialize(function()
28 openspace.addSceneGraphNode(Node)
29end)
30
31asset.onDeinitialize(function()
32 openspace.removeSceneGraphNode(Node)
33end)
Custom Appearance (Colored & Inverted)
This example shows an arrow pointing from one scene graph node in the direction of another. Here, it is created with the Solar System barycenter as start node and Earth as end node, but the arrow direction is inverted so that it points towards the Solar System barycenter. Some appearance related properties are also changed to customize the look of the arrow, but default values are used for its size.
1local earth = asset.require("scene/solarsystem/planets/earth/earth")
2local sunTransforms = asset.require("scene/solarsystem/sun/transforms")
3
4local Node = {
5 Identifier = "RenderableNodeArrow_Example_Appearance",
6 -- Parent to the start node, so that when we focus on the arrow this is where we end up
7 Parent = sunTransforms.SolarSystemBarycenter.Identifier,
8 Renderable = {
9 Type = "RenderableNodeArrow",
10 StartNode = sunTransforms.SolarSystemBarycenter.Identifier,
11 EndNode = earth.Earth.Identifier,
12 -- Point to start node instead of end node
13 Invert = true,
14 -- Give the arrow a custom color (here a dark red)
15 Color = { 0.5, 0.0, 0.0 },
16 -- Set the arrow head size so that it takes up a quarter (25%) of the full length of
17 -- the arrow
18 ArrowHeadSize = 0.25,
19 -- Set the arrow head width. A value of 1 makes it as wide as the body of the arrow
20 ArrowHeadWidthFactor = 1.0
21 },
22 GUI = {
23 Name = "RenderableNodeArrow - Custom Appearance (Colored & Inverted)",
24 Path = "/Examples"
25 }
26}
27
28asset.onInitialize(function()
29 openspace.addSceneGraphNode(Node)
30end)
31
32asset.onDeinitialize(function()
33 openspace.removeSceneGraphNode(Node)
34end)