line renderer in raycast with one starting point (mouse input) and multiple end point

The problem is on mouse input. the line renderer goes to the first point then from that point going to the last point (if ever i set a position.count=3;) on line renderer

what i want is on mouse input. if raycast hit the same tag on left point and bottom point. line renderer will draw a line from mouse input to the said point (left and bottom) at the same time. not going to the first point first then going to the end point.

can someone please help me with this ?

From the LineRenderer documentation:

if you need to draw two or more completely separate lines, you should use multiple GameObjects, each with its own Line Renderer.

Though I guess in your case you could work around it: since you want to draw multiple lines starting from the same point, you could simply add that origin point multiple times, so the line passes through it before going to the next target point:

positions[0] = ray.origin;
positions[1] = point1;
positions[2] = ray.origin;
positions[3] = point2;
...

Look at brackeys rider video on YouTube :slight_smile: