C#: make one with the Geom.Nodes.Polyline() factory, then set and read its properties
by name with Set and Get, or in the Inspector, where the node
is GeomPolyline.
A path in 3D space.
From code
The code used to generate this page's thumbnail.
var line := GeomPolyline.new()
var pts := PackedVector3Array()
pts.resize(25)
for i in 25:
var u := i / 24.0
pts[i] = Vector3(-1.2 + u * 2.4, sin(u * TAU) * 0.6, cos(u * TAU) * 0.3)
line.points = pts
line.join = Geom.JOIN_ROUND
line.thickness = 0.15
line.color = PINK
add_child(line) var line = Geom.Nodes.Polyline();
var pts = new Vector3[25];
for (int i = 0; i < 25; i++)
{
var u = i / 24.0f;
pts[i] = new Vector3(-1.2f + u * 2.4f, Mathf.Sin(u * Mathf.Tau) * 0.6f, Mathf.Cos(u * Mathf.Tau) * 0.3f);
}
line.Set("points", pts);
line.Set("join", (int)Geom.PolylineJoin.Round);
line.Set("thickness", 0.15f);
line.Set("color", PINK);
AddChild(line); Properties
| BlendMode | blend_mode | Geom.BLEND_TRANSPARENTGeom.BlendMode.Transparent |
| bool | closed | false |
| Color | color | Color(1, 1, 1, 1) |
| PolylineJoin | join | Geom.JOIN_MITERGeom.PolylineJoin.Miter |
| PackedVector3Array | points | PackedVector3Array() |
| float | thickness | 0.05 |
| ThicknessSpace | thickness_space | Geom.SPACE_WORLDGeom.ThicknessSpace.World |
Enumerations
enum Geom.ThicknessSpace
- Geom.SPACE_WORLDGeom.ThicknessSpace.World = 0
- World units, the same as a node's
position. - Geom.SPACE_VIEWPORT_PIXELSGeom.ThicknessSpace.ViewportPixels = 1
- The viewport's pixels. Constant size on screen at any zoom.
- Geom.SPACE_VIEWPORT_PERCENTGeom.ThicknessSpace.ViewportPercent = 2
- Percent of the viewport's shorter side. Like CSS
vmin.
enum Geom.PolylineJoin
- Geom.JOIN_SIMPLEGeom.PolylineJoin.Simple = 0
- The two segments meet at plain width, so the outside of the corner pinches in.
- Geom.JOIN_MITERGeom.PolylineJoin.Miter = 1
- The outside edges extend until they meet, clamped on sharp turns.
- Geom.JOIN_ROUNDGeom.PolylineJoin.Round = 2
- A disc over each corner.
- Geom.JOIN_BEVELGeom.PolylineJoin.Bevel = 3
- The outside of the corner cut off square.
enum Geom.BlendMode
- Geom.BLEND_OPAQUEGeom.BlendMode.Opaque = 0
- Sorts by position. Hard edges: no anti-aliasing, and alpha is ignored.
- Geom.BLEND_TRANSPARENTGeom.BlendMode.Transparent = 1
- Standard alpha blending. The default.
- Geom.BLEND_ADDITIVEGeom.BlendMode.Additive = 2
- Adds this color to what is behind.
- Geom.BLEND_MULTIPLYGeom.BlendMode.Multiply = 3
- Multiplies what is behind by this color.
- Geom.BLEND_SUBTRACTGeom.BlendMode.Subtract = 4
- Subtracts this color from the background.
- Geom.BLEND_TRANSPARENT_DEPTHGeom.BlendMode.TransparentDepth = 5
- Transparent, but writes depth, so shapes with alpha 1 sort by position with anti-aliased edges. A translucent color behaves like Transparent.
Property descriptions
BlendMode blend_mode = Geom.BLEND_TRANSPARENTGeom.BlendMode.Transparent
How the shape blends with what is behind it.
bool closed = false
Join the last point back to the first.
Color color = Color(1, 1, 1, 1)
Line color.
PolylineJoin join = Geom.JOIN_MITERGeom.PolylineJoin.Miter
How corners are drawn.
PackedVector3Array points = PackedVector3Array()
The path. Fewer than two points draws nothing.
float thickness = 0.05
Line width.
ThicknessSpace thickness_space = Geom.SPACE_WORLDGeom.ThicknessSpace.World
How thickness is measured.