I use CesiumJS, a javascript library, to render entities in a 3-dimensional space. I need to detect if one entity is "viewing" another entity. My initial thought is to use a cone to represent the field of view of the entity. I need to be able to make the cone variable angle and height. What is the most efficient way to check if Entity 2 is inside the cone emitted by Entity 1? I am doing this calculation a bunch of times so I am trying to find a way to do it efficiently.
In Cesium, my entities are plotted using Lat/long/alt, which I figured I could think of as X,Y,Z. I also know the orientation of each point, so I know which way to make the cone emit. Cesium has some built-in functions for checking intersections but all seem to use rays or lines emitting from entity 1, which don't give me my desired output. Any help would be greatly appreciated.