In my game I have a line that simulates the trajectory of a gun shot, fired by the main character.
The line starts at the character and ends at the mouse position at the moment of the click.
What happens is that sometimes the click is before the target. So the line does not extend to the target. I wish I could extend the line, at least to the end of the room.
What I would like to happen:
Attempt based on liggiorgio's answer: