Hi There :)
i have a laser attached to a gun in a 2D game and the question is
how can I make the Laser (Sprite) Stops at the detected body?
i don't want to see the sprite after the detected body
i'm Using Raycast2D to Detect Bodies And The Laser is a Sprite
i used a lot of methods but none of them worked like i wanted
func laser( ):
if $Cube/LaserSystem/LaserRay.iscolliding():
$Cube/LaserSystem/LaserRay/Sprite.setscale(Vector2(12.391(-1),0.304))
else:
$Cube/LaserSystem/LaserRay/Sprite.set_scale(Vector2(12.391,0.304))
What math Method Should I Use instead of decreasing scale.x by constant number?

link of the pic in case the browser didn't show it