Line trace intersecting angle

I’m not sure the best way to word this question. I want to find the first intersecting angle from a camera to a large sphere below it. I know how to use the line trace function but I was wondering if there is a better way than progressively line tracing angles since I want a precise result. Picture a camera above the Earth, trying to find the furthest visible point of the horizon at whatever given height.

If you know the radius of the sphere and the height of the player camera relative to the surface of the sphere, the distance to the furthest visible point on the horizon can be found by the formula:

d^2 = h^2 + 2Rh

Where d is the distance to the point the camera can see, h is the height of the camera, and R is the radius of the sphere.

131578-f.png

The height of the player could be gotten by the distance between the spheres location and the cameras location, minus the radius of the sphere.

Thanks! I noticed a slight discrepancy between the actual math and the line trace testing. I’m guessing its to do with the geometry of the collision map of my sphere since its not consistent.