Is there a simple way to draw text along an arc or any arbitrary path? I could imagine using draw_char
but I don't know how I would rotate the character.
Draw text along a circle/arc/path?
17 days later
- Edited
You can use draw_set_transform
(docs.godotengine.org/en/stable/classes/class_canvasitem.html#class-canvasitem-draw-set-transform).
Something like this should work.
var my_string = "Hello World"
var x = (360) / my_string.length()
for i in range(0, my_string.length()):
draw_set_transform(Vector2(0, 0), deg2rad(i * x - (my_string.length()/2*x)), Vector2(1,1))
draw_char(font, Vector2(0, -30), my_string[my_string.length()-i-1], "", Color(0, 0, 0)
a month later
I did not see that this got answered. That worked great. Thanks for doing the leg work, it looks about as ugly as I imagined it would be ;). Thanks.
P.S.
To get it working I added a label to the scene and used var font = get_node("font_label").get_font('')
to populate the font...just in case anyone else is all..."font isn't defined" and what not. It's a dumb hack and I know there are other ways to do this but I was lazy.
5 years later
forgot end bracket