Drawing line for raycast collision distance ?

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

Trying to draw bullets trail using raycast2d and draw line, so if a bullet hits target the trail ends…

rcp = raycast.get_global_transform().origin.distance_to(raycast.get_collision_point())
draw_line(raycast.position, Vector2(rcp, 0), Color.red, 1, true)

For some reason the line this draws is too short…

Let me know if I need to clarify what I mean. Sorry I am very tired its late.

:bust_in_silhouette: Reply From: wildboar

Fixed this morning with


, instead raycast…