How can i create a trail for a ball?

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

I want to create a straight line trail for a ball spawned in the scene. Particles2d creates a discontinuity in the trail as particles are emitted with gap between successive particles. How can I make a straight line trail with its width equal to width of the ball?

:bust_in_silhouette: Reply From: Vincent Grossmayer

have you had a look at a Line2D?
you can simply set two points for your line. one would be Vector2(0, 0) and the second would be -ball_velocity.normalized() * line_length.
The second point uyou would need to set every physics frame.