DashboardItemDistance
Inherits DashboardItem
This DashboardItem displays the distance between two points. The points can be defined either by the location of a scene graph node, the surface of a scene graph node’s bounding sphere, the location of the current focus node, or the position of the camera. These definitions can be mixed and matched to calculate any combination of positions.
The resulting text can be formatted in the FormatString and the measurement unit is chosed by changing the Simplification and RequestedUnit parameters.
Members
Name |
Documentation |
Type |
Description |
Optional |
|---|---|---|---|---|
|
The type of position that is used as the destination to calculate the distance. |
|
In list { Node, Node Surface, Focus, Camera } |
No |
|
The type of position that is used as the source to calculate the distance. |
|
In list { Node, Node Surface, Focus, Camera } |
No |
|
If a scene graph node is selected as type, this value specifies the identifier of the node that is to be used as the destination for computing the distance. |
|
Value of type ‘String’ |
Yes |
|
This value is the name of the font that is used. It can either refer to an internal name registered previously, or it can refer to a path that is used. |
|
Value of type ‘String’ |
Yes |
|
This value determines the size of the font that is used to render the distance. |
|
Value of type ‘Double’ |
Yes |
|
The format string that is used for formatting the distance string. This format receives four parameters: The name of the source, the name of the destination the value of the distance and the unit of the distance. |
|
Value of type ‘String’ |
Yes |
|
If the simplification is disabled, this distance unit is used as a destination to convert the meters into. |
|
In list { Nanometer, Micrometer, Millimeter, Centimeter, Decimeter, Meter, Kilometer, AU, Lighthour, Lightday, Lightmonth, Lightyear, Parsec, Kiloparsec, Megaparsec, Gigaparsec, Gigalightyear, Thou, Inch, Foot, Yard, Chain, Furlong, Mile, League, Nautical Mile } |
Yes |
|
If this value is enabled, the distance is displayed in nuanced units, such as km, AU, light years, parsecs, etc. If this value is disabled, the unit can be explicitly requested. |
|
Value of type ‘Boolean’ |
Yes |
|
If a scene graph node is selected as type, this value specifies the identifier of the node that is to be used as the source for computing the distance. |
|
Value of type ‘String’ |
Yes |
Inherited members from DashboardItem
Name |
Documentation |
Type |
Description |
Optional |
|---|---|---|---|---|
|
The unique identifier for this DashboardItem. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
Determines the type of the DashbordItem that should be created. |
|
Value of type ‘String’ |
No |
|
If this value is set to ‘true’ this dashboard item is shown in the dashboard. Otherwise it will be hidden. |
|
Value of type ‘Boolean’ |
Yes |
|
The name for the DashboardItem that is used when showing it in the user interface. |
|
Value of type ‘String’ |
Yes |
Asset Examples
NodeSurface-Camera
This example adds two invisible nodes and a dashboard item that shows the distance between those two nodes
1local Node = {
2 Identifier = "DashboardItemDistance_Example_NodeSurfaceCamera_Node",
3 BoundingSphere = 200.0,
4 GUI = {
5 Name = "DashboardItemDistance - NodeSurface-Camera"
6 }
7}
8
9local Item = {
10 Identifier = "DashboardItemDistance_Example_NodeSurfaceCamera",
11 Type = "DashboardItemDistance",
12 SourceType = "Node Surface",
13 SourceNodeIdentifier = Node.Identifier,
14 DestinationType = "Camera"
15}
16
17asset.onInitialize(function()
18 openspace.addSceneGraphNode(Node)
19 openspace.dashboard.addDashboardItem(Item)
20end)
21
22asset.onDeinitialize(function()
23 openspace.dashboard.removeDashboardItem(Item)
24 openspace.removeSceneGraphNode(Node)
25end)
Node-Camera
This example adds an invisible node and a dashboard item that shows the distance between this node and the current focus node.
1local Node = {
2 Identifier = "DashboardItemDistance_Example_NodeCamera_Node",
3 GUI = {
4 Name = "DashboardItemDistance - Node-Camera"
5 }
6}
7
8local Item = {
9 Identifier = "DashboardItemDistance_Example_NodeCamera",
10 Type = "DashboardItemDistance",
11 SourceType = "Node",
12 SourceNodeIdentifier = Node.Identifier,
13 DestinationType = "Camera"
14}
15
16asset.onInitialize(function()
17 openspace.addSceneGraphNode(Node)
18 openspace.dashboard.addDashboardItem(Item)
19end)
20
21asset.onDeinitialize(function()
22 openspace.dashboard.removeDashboardItem(Item)
23 openspace.removeSceneGraphNode(Node)
24end)
Node-Node
This example adds two invisible nodes and a dashboard item that shows the distance between those two nodes.
1local Node1 = {
2 Identifier = "DashboardItemDistance_Example_NodeNode_Node1",
3 GUI = {
4 Name = "DashboardItemDistance - Node-Node (Node 1)"
5 }
6}
7
8local Node2 = {
9 Identifier = "DashboardItemDistance_Example_NodeNode_Node2",
10 Transform = {
11 Translation = {
12 Type = "StaticTranslation",
13 Position = { 2.0, 0.0, 0.0 }
14 }
15 },
16 GUI = {
17 Name = "DashboardItemDistance - Node-Node (Node 2)"
18 }
19}
20
21local Item = {
22 Identifier = "DashboardItemDistance_Example_NodeNode",
23 Type = "DashboardItemDistance",
24 SourceType = "Node",
25 SourceNodeIdentifier = Node1.Identifier,
26 DestinationType = "Node",
27 DestinationNodeIdentifier = Node2.Identifier
28}
29
30asset.onInitialize(function()
31 openspace.addSceneGraphNode(Node1)
32 openspace.addSceneGraphNode(Node2)
33 openspace.dashboard.addDashboardItem(Item)
34end)
35
36asset.onDeinitialize(function()
37 openspace.dashboard.removeDashboardItem(Item)
38 openspace.removeSceneGraphNode(Node2)
39 openspace.removeSceneGraphNode(Node1)
40end)
Node-Focus
This example adds an invisible node and a dashboard item that shows the distance between this node and the current focus node.
1local Node = {
2 Identifier = "DashboardItemDistance_Example_NodeFocus_Node",
3 GUI = {
4 Name = "DashboardItemDistance - Node-Focus"
5 }
6}
7
8local Item = {
9 Identifier = "DashboardItemDistance_Example_NodeFocus",
10 Type = "DashboardItemDistance",
11 SourceType = "Node",
12 SourceNodeIdentifier = Node.Identifier,
13 DestinationType = "Focus"
14}
15
16asset.onInitialize(function()
17 openspace.addSceneGraphNode(Node)
18 openspace.dashboard.addDashboardItem(Item)
19end)
20
21asset.onDeinitialize(function()
22 openspace.dashboard.removeDashboardItem(Item)
23 openspace.removeSceneGraphNode(Node1)
24end)