I will make a ray from a part (start pos) and get an end position, and knowing the lenght of both segments, set the cframe of the two parts to make the “leg”
The problem is that i can not get the adyacent side, i could if both segments had the same lenght, making the adjacent side of the triangles be equal to distance/2 but is not the case, and i dont know how i can get it
Your description is a little confusing because you refer to seg 2 and say in orange “but starting from the end position and looking to the start position” but you didn’t specify if you were refering to the seg 1 start and end, or the seg 2 start and end.
Please edit your post so we can more easily understand what you mean.
local a = s2.lenght
local b = distance
local c = s1.lenght
local dir = math.acos(
( (a*a) -(c*c) -(b*b) ) / ( -2 * c * b)
)
warn(dir)
local lookCframe = CFrame.lookAt(start,goal) * CFrame.Angles(dir,0,0)
cf = lookCframe + lookCframe.LookVector * (s1.lenght/2)