Line2d, use texture only for points

Godot Version

4.3.stable

Question

Hello
I am trying to draw a line with Line2d, but would only like the dots to appear, thus making a dotted line, but when I draw it, it still connects the dots with a line, how can I achieve a dotted line using Line2d? Thank you.

You could use a custom _draw function to draw what/where you need to.

That does sound like a good solution, I tried it and it’ll work, but I think the processing may create overheads, as I only need the texture of Line2d to draw at point position without connecting them with a line, It’s not that custom, so I thought maybe Line2d has already something in-built?

Ok, I have found the best solution with minimum re-work, is just to override the _draw function in Line2d and there draw the points via a loop:

for p in points:
      draw_circle(p, 4, Color.WHITE)

Yep, that’s what i meant. There is even a builtin draw_dashed_line if you want to draw the dashed line in between the points.

Understood. Thank you. Marked your response as “Resolution”