Checking occlusion:
%ray = containerRayCast(%a.getEyePoint(), %b.getEyePoint(), $TypeMasks::FxBrickObjectType);
if (%ray)
// ... something is in the way
else
// ... there is a direct line of sight from eye to eye
Checking FOV (assuming %a is trying to look at %b and has a client):
%angle = %a.client.getControlCameraFOV();
%direct = vectorNormalize(vectorSub(%b.getPosition(), %a.getPosition()));
%product = vectorDot(%a.getEyeVector(), %direct);
if (%product >= 1 - (%angle / 360) * 2)
// ... %b is within %a's viewcone
else
// ... %b is outside of %a's viewcone
Hull traces might also prove useful.