RenderableNodeLine
Inherits Renderable
This Renderable
connects two scene graph nodes by drawing a line between them. The line will update dynamically if the position of the nodes change.
One use case for the RenderableNodeLine
is to visualize the distance between two objects. For this, a RenderableDistanceLabel can also be added to show the distance as a number. That renderable is designed to show the distance between the start and end node for a given RenderableNodeLine
.
Members
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
The RGB color for the line. |
|
Value of type ‘Color3’ |
Yes |
|
The identifier of the node the line ends at. Defaults to ‘Root’ if not specified. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
Yes |
|
A distance to the end node at which the rendered line should end. By default it takes a value in meters, but if ‘UseRelativeOffsets’ is set to true it is read as a multiplier times the bounding sphere of the node. |
|
Value of type ‘Double’ |
Yes |
|
The width of the line. The larger number, the thicker the line. |
|
Value of type ‘Double’ |
Yes |
|
The identifier of the node the line starts from. Defaults to ‘Root’ if not specified. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
Yes |
|
A distance from the start node at which the rendered line should begin. By default it takes a value in meters, but if ‘UseRelativeOffsets’ is set to true it is read as a multiplier times the bounding sphere of the node. |
|
Value of type ‘Double’ |
Yes |
|
If true, the offset values are interpreted as relative values to be multiplied with the bounding sphere of the start/end node. If false, the value is interpreted as a distance in meters. |
|
Value of type ‘Boolean’ |
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, Overlay, PostDeferredTransparent, Sticker } |
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 draws a line between two nodes in the scene, in this case the planets Earth and Mars.
Note that this example asset is used in another example, for
RenderableDistanceLabel. Due to this, we export the
Node
table so we can access and refer to its identifier in the other example, the
same way as we do for Earth and Mars in this asset.
1local earth = asset.require("scene/solarsystem/planets/earth/earth")
2local mars = asset.require("scene/solarsystem/planets/mars/mars")
3
4local Node = {
5 Identifier = "RenderableNodeLine_Example",
6 Renderable = {
7 Type = "RenderableNodeLine",
8 StartNode = earth.Earth.Identifier,
9 EndNode = mars.Mars.Identifier
10 },
11 GUI = {
12 Name = "RenderableNodeLine - Basic",
13 Path = "/Examples"
14 }
15}
16
17asset.onInitialize(function()
18 openspace.addSceneGraphNode(Node)
19end)
20
21asset.onDeinitialize(function()
22 openspace.removeSceneGraphNode(Node)
23end)
24
25-- Export the Node table so it can be used in another example
26asset.export("NodeLine", Node)