Draw line attached to raycast in 2D

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

Hi, i have a function that draws a raycast when the left mouse button is clicked. I’m wondering how i would go about making a line or texture that can visualize where the raycast was drawn.

You could try using a Line2D

godot_dev_ | 2023-06-03 15:38

:bust_in_silhouette: Reply From: ShatteredReality

Use draw_line() function in CanvasItem.draw() function. CanvasItem — Godot Engine (stable) documentation in English

Or line2d like the comment said.

Or enable collision shapes debug in the settings.