- Home /
Question by
Milenchy · Nov 01, 2016 at 10:39 PM ·
c#rendererlinerenderer
How to create a line renderer with end point as the mouse position, but facing only one direction
I have two objects with a line going from one to the other, like this:
I want to create another line with a starting point one of the objects and an end point the mouse position, however still facing the second object, which will look like the first line is filling up to where the mouse is, like this:
There is no way (as far as I know) to set a direction of a line renderer in Unity, so how can I achieve this?
capture.png
(5.7 kB)
untitled2.png
(6.2 kB)
Comment
I'm not a maths genious but my general advice would be:
Find a vector which is perpendicular to this line and contains the point of the mouse raycast, then find the point where those two vectors cross and draw the line up to that point. But I have no Idea how to caluclate this.