Equivalent of _draw() in 3D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Suleymanov

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!

:bust_in_silhouette: Reply From: sergkis

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 GitHub - dbp8890/line-renderer: A GDScript implementation of a line renderer in Godot.