Skip to content

Trail3D

Inherits: LineBase3D < GeometryInstance3D < VisualInstance3D < Entity3D < Entity < Object

A node to draw lines behind moving objects.

The Trail3D node draws a flat line in space, with an optional billboard mode.

Note: This node is designed for visual effects. For solid lines, pipes, and tubes, use a CSGPolygon3D node in CSGPolygon3D.MODE_PATH mode.

Type Name Default
Color color Color(1, 1, 1, 1)
Gradient color_gradient
bool emitting true
float lifetime 0.2
LimitMode limit_mode 0
ShaderMaterial material
LineBase3D.MaterialMode material_mode 0
float max_length
LineBase3D.MeshAlignment mesh_alignment 1
float min_section_length 0.2
bool pin_uv false
LineBase3D.TilingMode tiling_mode 1
float tiling_multiplier 1.0
float width 0.3
Curve width_curve
Returns Method
void clear()
float get_current_length() const

LimitMode

enum LimitMode

LIMIT_MODE_LIFETIME = 0

Limit the trail length in time.

LIMIT_MODE_MAX_LENGTH = 1

Limit the trail length in size.

LIMIT_MODE_MAX = 2

Represents the size of the LimitMode enum.

color

Color color = Color(1, 1, 1, 1)

The color of the trail.

Note: Colors with values above 1.0 (overbright) are not supported.

Note: To have a visible effect on a BaseMaterial3D, BaseMaterial3D.vertex_color_use_as_albedo must be true. For a ShaderMaterial, ALBEDO *= COLOR.rgb; must be inserted in the shader’s fragment() function. Otherwise, color will have no visible effect.

color_gradient

Gradient color_gradient

The color gradient over the trail length.

Note: Colors with values above 1.0 (overbright) are not supported.

Note: To have a visible effect on a BaseMaterial3D, BaseMaterial3D.vertex_color_use_as_albedo must be true. For a ShaderMaterial, ALBEDO *= COLOR.rgb; must be inserted in the shader’s fragment() function. Otherwise, color will have no visible effect.

emitting

bool emitting = true

If true, the trail will generate new points from its head.

Note: Only one active trail is supported. Setting this property to true will cause the existing trail mesh to be cleared.

lifetime

float lifetime = 0.2

The lifetime of the trail when limit_mode is LIMIT_MODE_LIFETIME.

limit_mode

LimitMode limit_mode = 0

Whether to limit the trail by lifetime or length.

material

ShaderMaterial material

The material to assign to the trail mesh when material_mode is LineBase3D.MATERIAL_MODE_CUSTOM.

Tip: To preserve billboarding, use the following shader as a base:

material_mode

LineBase3D.MaterialMode material_mode = 0

The material mode for the trail.

max_length

float max_length

The maximum length of the trail when limit_mode is LIMIT_MODE_MAX_LENGTH.

mesh_alignment

LineBase3D.MeshAlignment mesh_alignment = 1

Alignment of the trail. Possible options are LineBase3D.MESH_ALIGNMENT_LOCAL for a 3D line, and LineBase3D.MESH_ALIGNMENT_BILLBOARD for a billboarded line.

min_section_length

float min_section_length = 0.2

Minimum required distance before adding a new section.

pin_uv

bool pin_uv = false

If true, pins the UVs to their positions in space.

tiling_mode

LineBase3D.TilingMode tiling_mode = 1

How to tile the UVs across the length of the trail.

tiling_multiplier

float tiling_multiplier = 1.0

UV multiplier across the length of the trail.

width

float width = 0.3

Width of the trail.

width_curve

Curve width_curve

Width across the length of the trail.

clear

void clear()

Clears the trail.

get_current_length

float get_current_length() const

Returns the current length of the trail.