Unity 2D -Reflecting a linerenderer

Hello, I’m fairly new to programming. I want to make a linerenderer from a gun reflect when hitting a tilted wall. And after that to bounce based on next walls rotation. How should I do that ? Should I store the hit.points in a list? I can find the line renderers origin ( this.transform.position) but can’t seem to find direction. Unity only offers vector2.right left up and down.

You should use Vector3.Reflect
Here’s the manual on using that: Unity - Scripting API: Vector3.Reflect

I would use Vector2.Reflect. Use the direction of the weapon-fire as the direction parameter and the normal of the wall as the normal. If you don’t have the normal readily available - like if you are rendering them using a line renderer and just storing vectors, you can use the right or left property of the vector you use to draw the lines.

From your picture, it seems like you want to prevent reflection when the wall is roughly perpendicular. You can use the dot product of the unit version of each vector to determine how close they are to parallel.