0 votes

Given initial and final Vector2( ) position, How can a dotted / dashed line be drawn ?

in Engine by (77 points)

2 Answers

+1 vote

Unfortunately, there is no built-in function for that in Godot yet. You must implement it yourself.

Here is one example I found which might helps you to start with it:

by (148 points)

There is a built-in way to achieve this with Godot using the Line2D node, but you need to supply your own dashed/dotted line texture.

+1 vote

You can use draw_multiline() and save positions from a point to another.

You can see how it works in this video:
In the video the dotted line follows a sine.

min: 13:20

by (396 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.