How can I get the angle from the camera to a casted ray's position

Not really sure how to word it correctly in my title but I want to get the angle from a ray’s position to the camera like this:

If the hypotenuse of the triangle is the length of the ray then how can I get that angle?

This might not be the neatest way of doing it but you could use the :Dot() method to find the angle between that vector and an imaginary vector which travels horizontally to the original vector. The dot product returns the cos of the angle between two vectors multiplied by the magnitude of those vectors, so if you divided by their respective magnitudes you could then get the angle.

This post explains it in a better way:

EgoMoose’s guide on the dot product:

2 Likes