I am looking to make a dotted-line. So far no luck. Has anyone a good solution?
How i make a dotted line in Godot?
You can use Line2D with a texture, for example: a rectangle divided into one square with a dot and one empty square
- Edited
This seems to work
func draw_dotted_line(point_dist):
var points = rocketCurve.get_baked_points()
var point_count = points.size()
var last_point = Vector2(0,0)
var current_point = Vector2(0,0)
var distance = 0.0
var _point_index = 0
for i in range(point_count):
current_point = points[i]
if i > 0:
distance += last_point.distance_to(current_point)
while distance > point_dist:
_point_index = i - 1
var t = 0.50
var circle_point = last_point.lerp(current_point,t)
draw_circle(round(circle_point),4,Color.YELLOW)
distance -= point_dist
last_point = current_point
a month later
This is the project I wrote, hope he can help you.