- Home /
i want to create a triangle from 2 3d vectors
Hi i am trying to do a triangle from 2 given 3d vectors and i want the triangle to be symetrical and i dont know how to get the last 3d vector
and with symetrical i mean the sides are equal length
Well the third vector (lets call it C) in a triangle is always C= A+B This assumes that the first is A and the second is B.
If you want a triangle with equal long sides then you have to have an angle of 60° between the first 2 vectors or this is not possible. (assu$$anonymous$$g that you want all sides to be equally long) If only 2 sides have to be equally long let me know. That is easier done.
Answer by myzzie · May 04, 2019 at 03:18 PM
There is no last vector, what you're looking for is a circle. Then you can define where in that circle you want to put your last point.
Vector3 dir = (B-A).normalized;
float dist = Vector3.Distance(A, B);
Vector3 perp = Vector3.Cross(dir, Vector3.up).normalized;
C = Quaternion.AngleAxis(60, perp) * dir * dist;