A node to draw lines behind moving objects.
The [Trail3D] node draws a flat line in space, with an optional billboard mode.
[b]Note:[/b] This node is designed for visual effects. For solid lines, pipes, and tubes, use a [CSGPolygon3D] node in [constant CSGPolygon3D.MODE_PATH] mode.
Clears the trail.
Returns the current length of the trail.
The color of the trail.
[b]Note:[/b] Colors with values above [code]1.0[/code] (overbright) are not supported.
[b]Note:[/b] To have a visible effect on a [BaseMaterial3D], [member BaseMaterial3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
The color gradient over the trail length.
[b]Note:[/b] Colors with values above [code]1.0[/code] (overbright) are not supported.
[b]Note:[/b] To have a visible effect on a [BaseMaterial3D], [member BaseMaterial3D.vertex_color_use_as_albedo] [i]must[/i] be [code]true[/code]. For a [ShaderMaterial], [code]ALBEDO *= COLOR.rgb;[/code] must be inserted in the shader's [code]fragment()[/code] function. Otherwise, [member color] will have no visible effect.
If [code]true[/code], the trail will generate new points from its head.
[b]Note:[/b] Only one active trail is supported. Setting this property to [code]true[/code] will cause the existing trail mesh to be cleared.
The lifetime of the trail when [member limit_mode] is [constant LIMIT_MODE_LIFETIME].
Whether to limit the trail by lifetime or length.
The material to assign to the trail mesh when [member material_mode] is [constant LineBase3D.MATERIAL_MODE_CUSTOM].
[b]Tip:[/b] To preserve billboarding, use the following shader as a base:
[codeblock]
shader_type spatial;
render_mode blend_mix, depth_draw_never, unshaded, skip_vertex_transform, cull_disabled;
void vertex() {
// Billboarding code for trails
// CUSTOM0 contains the tangent of the trail and the width.
if (dot(CUSTOM0.xyz, CUSTOM0.xyz) > 0.0) {
vec3 p = (inverse(MODELVIEW_MATRIX) * vec4(0.0, 0.0, 0.0, 1.0)).xyz;
p = VERTEX - p;
vec3 t = CUSTOM0.xyz;
vec3 binormal = normalize(cross(p, t));
vec3 normal = normalize(cross(t, binormal));
vec3 tangent = normalize(cross(binormal, normal));
VERTEX += CUSTOM0.w * binormal;
NORMAL = normal;
TANGENT = tangent;
BINORMAL = binormal;
}
}
void fragment() {
ALBEDO = COLOR.rgb;
ALPHA = COLOR.a;
}
[/codeblock]
The material mode for the trail.
The maximum length of the trail when [member limit_mode] is [constant LIMIT_MODE_MAX_LENGTH].
Alignment of the trail. Possible options are [constant LineBase3D.MESH_ALIGNMENT_LOCAL] for a 3D line, and [constant LineBase3D.MESH_ALIGNMENT_BILLBOARD] for a billboarded line.
Minimum required distance before adding a new section.
If [code]true[/code], pins the UVs to their positions in space.
How to tile the UVs across the length of the trail.
UV multiplier across the length of the trail.
Width of the trail.
Width across the length of the trail.
Limit the trail length in time.
Limit the trail length in size.
Represents the size of the [enum LimitMode] enum.