Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Line2D

Inherits: Node2D < CanvasItem < Node < Object

A 2D polyline that can optionally be textured.

Description

This node draws a 2D polyline, i.e. a shape consisting of several points connected by segments. Line2D is not a mathematical polyline, i.e. the segments are not infinitely thin. It is intended for rendering and it can be colored and optionally textured.

Warning: Certain configurations may be impossible to draw nicely, such as very sharp angles. In these situations, the node uses fallback drawing logic to look decent.

Note: Line2D is drawn using a 2D mesh.

Tutorials

Properties

bool

antialiased

false

LineCapMode

begin_cap_mode

0

bool

closed

false

Color

default_color

Color(1, 1, 1, 1)

LineCapMode

end_cap_mode

0

Gradient

gradient

LineJointMode

joint_mode

0

PackedVector2Array

points

PackedVector2Array()

int

round_precision

8

float

sharp_limit

2.0

Texture2D

texture

LineTextureMode

texture_mode

0

float

width

10.0