So i need to implement something so my AI can see the player.
1) Pawn Sensing Component, Very limited and i was told that it’s outdated and i should use the new AI Perception Component instead.
2) AI Perception Component, Has been in development for a while at epic but is still extremely buggy and documentation is minimal at best making it hard to understand.
3) Custom code solution, When i was investigating what AI sensing component RoboRecall used in their mod kit, I found that they don’t use either of the two iv’e listed above
and instead use the custom code below:
// is target within our vision cone?
FVector const ToTargetNorm = (TraceEnd - ViewLoc).GetSafeNormal();
FVector const EyesForwardNorm = ViewRotation.Vector();
float const AngleCos = FVector::DotProduct(ToTargetNorm, EyesForwardNorm);
float const CosLimit = FMath::Cos(FMath::DegreesToRadians(AIVisionAngle));
if (bDrawDebugVisionCone)
{
DrawDebugCone(World, ViewLoc, EyesForwardNorm, 300.f, FMath::DegreesToRadians(AIVisionAngle), FMath::DegreesToRadians(AIVisionAngle), 12, FColor::Yellow, false, 1.f);
}
bInVisionCone = (AngleCos >= CosLimit);
Question: So which one should i use? Is there something i’m missing?