Vertical Angle Between two game objects

The blue angle in the attached photo is what I need. You can see I have a direction (drawn in red in unity) that is correct. The start of the direction is a camera on the AI NPC (on the right). And the end is the player.

Vector3 dir = targetHead.transform.position - camera.Value.transform.position;
Debug.DrawRay(camera.Value.transform.position, dir, Color.red);

I’m trying to get the angle because I need to lerp the npc object mecanim body_vertical property (-1 to 1) relative to that angle so that the npc is always aiming at the player.

I have tried numerous solutions, they all end up with an angle that is projected on the plane the npc is standing on instead of a -90 (looking down) all the way up to 90 (looking up) regardless of which direction the source or the target is facing x and z. Any help would be great.
88146-angle.png

This seems like a trigonometry question, like NoseKills said.
Assuming you have GameObjects ‘targetHead’ and ‘camera’ (that’s what they appear to be named in the code snippet), the vertical angle could be found with this code:

///You know the vertical difference (we'll call it side b of the triangle) of the transforms and the horizontal difference (we'll call it side a of the triangle). Therefore the tangent of angle B (the corner opposite side b) would be equal to (side b / side a). To find the angle in radians, you would find the arctangent of that value and then convert it to an angle.

float sideA = Vector3.Distance(camera.transform.position, new Vector3(targetHead.transform.position.x, camera.transform.position.y, targetHead.transform.position.z));
//Horizontal distance to targetHead
float sideB = targetHead.transform.position.y - camera.transform.position.y;
//Vertical difference
float angleRad = Mathf.Atan(sideB/sideA);
//Or if degrees are needed
float angleDeg = angleRad * Mathf.Rad2Deg;

NoseKills and JSierraAKAMC are on the right track to use trig, but i think there’s a better approach.

it sounds like you want to find the angle between two vectors.
this is pretty straight-forward.

the dot-product of two vectors is the cosine of the angle between the vectors times the length of each vector. so you can go in reverse. first, make normalized copies of the vectors (to make their length equal to one), then take the dot-product of the normalized vectors, and then the ArcCosine of that.

float radiansBetweenVectors(Vector3 vA, Vector3 vB) {
  vA.normalize();
  vB.normalize();
  float ADotB = vA.Dot(vB);
  float radians = Math.Acos(ADotB);
  return radians;
}