+1 vote

I used to _draw()Path2D and the control points in 2D games like:

func _draw():
    draw_polyline($Path.curve.get_baked_points(), Color.red, 2, true)
    for p in $Path.curve.get_point_count():
        draw_circle($Path.curve.get_point_position(p), 8, Color.red)
    update()

Obviously, it doesn't work in 3D games. What is the equivalent of that in 3D?

In other words, I want the Path curve and control points to be visible in Play Mode. How can that be achieved?

Thank you for your time!

Godot version 3.2.3
in Engine by (327 points)

1 Answer

0 votes

You can use ImmediateGeometry node to draw something from code.
See https://docs.godotengine.org/en/stable/classes/class_immediategeometry.html
Also, you can take a look at https://github.com/dbp8890/line-renderer

by (107 points)
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 Frequently asked questions and 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.