Triangle in 3d Space finding Point C?

Imagine an Human.

  • Point A would be the Head.
  • Point B would be his right Shoulder.
  • length a would be his Arm.
  • the c length is the distance of Head and Shoulder.
  • C is somewhere on the Z axis of Point A.

I want to find the C Point.
The C Point would be the furthest reachable Point.

(I will refer to the Point A in bold, the Angle A in italics, and the distance a in lowercase)

To calculate the angle A, you can use a dot product between AB and AC. Since you don’t know C, you can use a vector that is in the same direction as C from A as a stand-in to calculate A. A good stand in for this vector would be (A + +Z where +Z is the unit vector in the positive Z direction).

So, we know AB · AC = ||AB|| * ||AC|| * cosθ.

Conveniently, we can actually just use the built in Vector3.Angle function to do the dot product for us. In code we have something like:

// a, and b are assumed to be Vector3 types that correspond to Point A, and Point B
float angle = Vector3.Angle(b - a, Vector3.forward);

Then you can use this angle, in conjunction with the lengths c and a to solve this as a SSA triangle. It is possible that there will be two such triangles to select from. See: SSA doesn't work - Math Open Reference and Use the Law of Cosines for SSA - dummies