Hello, I develop a script to drag a lever with the mouse cursor I use for this a hingejoint.
But I have problems with a calculation, because the triangle have not a 90° angle.
Please take a look at the picture.
(I do not understand what wikipedia write about this problem)
I think you could use the “Law of Cosine”. The following formula should do the trick:
“pink_line_length” = “mouse_drag” - “known_length” + square(2 * “mouse_drag” * “known_length” * cos(“known_angle”))
Easy to get it wrong but I think that should be correct (square means that you should take the square root of everything inside the bracers) 
Hi
Thank you for your fast answer.
There is a little problem… I have not described this correctly.
The mouse_drag is unknow too - Otherwise I can use Vector3.Distance(“camera.position”, “raycast_hitpoint” - “mouse_drag”).
Have you an other idea? 
Well it should be very possible to calculate how far you drag the mouse? Though I don’t know how to “calculate” the relationship between the 2D mouse coordinates on the screen and the in-game 3D coordinates…but if you did this somehow, then you should be able to calculate the drag distance easily (its a little outside my math knowledge :)).
Many games have a"Click to Move" feature (strategy games) where the character moves wherever you click with your mouse…which means that they can transform the 2D coordinate into 3D somehow and if you did this you could easily get the position where you started/stopped dragging and calculate the “mouse_drag”.
I found not a way to calculate the mouse_drag. But I have a new idea for that problem!
I use other points and now I can use a triange with 90 degrees.
But I have a new problem, because I don’t know how I can know the direction
of the calculated length.
In the picture, I have used simply transform.y - calculated_length to draw the line, but the direction is not
correct 
Please help again 
Hope you understand my pictures and my bad english!