Hello there !
So I’m not entirely new to unity but I tend to have a very limited knowledge outside of scripting.
Im trying to implement some sort of raygun in a side-scroller space-themed shoot them up.
I’m trying to achieve a continuous ray to shoot the ennemies, but the trick behavior is that when you would move the ship up or down, it would “wave” the ray, and then that wave would get to the end of the ray (making it the new line).
Allow me to make a very sophisticated draw.
This would be the ship shooting straight:

And the after a movement (here, down) the beginning of the ray would still be in front of the ship but the old horizontal position would remain for a moment. 
That wave would then sort of “catch up” on the right overt time and eventually the new line would be straight again but at the new horizontal position.
So here I went in programmer mode thinking how the hell am i going to develop this, thinking about having an array of dots representing the coordinates of the line, and performing a local Lagrange polynomial (Lagrange polynomial - Wikipedia) to interpolate a line between the dots.
But to be honnest i can already see thousands of problems of the generated curve not behaving like i would like. So here i am turning to you (thank you for reading all that appreciate it).
I am searching for a way of achieving this effect, and franckly im not sure where to start :
- Maybe scripting a line rederer would help and giving it the points trough a C# script ?
- A more curvy wapproach seems the new spriteshape API but is it really adequate to have some gameplay around it next such as damage calcuation and such?
- Maybe should I program it from scratch but there is a way better approache than mine ?
Basically im taking any idea or similar project you could have to help me trough this problem.
Many thanks for your help !
Friendly,
Kevin ![]()
