system
February 7, 2017, 9:59pm
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
Mefihl
Old Version
Published before Godot 3 was released.
How draw line from point to point like this?
Your image isn’t showing.
avencherus | 2017-02-07 22:03
system
February 7, 2017, 10:48pm
4
Reply From:
volzhs
There is draw_line
, draw_polygon
, draw_primitive
, draw_rect
method.
You can draw something in func _draw()
with these method.
If you want to call _draw()
to update, use update()
And there is pending PR for more elegant way.
godotengine:master
← Zylann:polyline
opened 06:22PM - 22 Dec 16 UTC
Added a Line2D node that draws a polygon-based line.
It supports unlimited widt… h, color gradient, texture and some geometry options for joints and caps. Also transparency without artifacts (provided that line joints aren't too sharp).
~~Points cannot be visually edited yet because I have to figure out how to do that without duplicating too much similar code from existing editors (polygon2d, shape2d...).~~
Some features can be added over time such as variable width (would be nice to provide that through a FloatCurve resource) and more texturing options.
EDIT: points can be edited now :)
The logic that builds the line can be re-used for a future Trail2D node.