I trying to draw enemy healthbar over his head.
At first I found bounding box that contains enemy:
FBox boundingBox = EnemyInfoArray[i].Actor->GetComponentsBoundingBox();
Then I project world coordinates to screen:
pos = Project(EnemyInfoArray[i].Actor->GetActorLocation());
And then use it like this:
posX = pos.X - mainWidth / 2 + border / 2;
posY = Project(boundingBox.Max).Y - mainHeight + border / 2;
DrawRect(FLinearColor::Red, posX, posY, healthWidth, mainHeight);
And the problem is that when I rotate my camera (FPS) 180 dergees healthbar still visible on screen. I trying use LineOfSightTo() and GetLastRenderTime() to determine visible actor or not but the both affected only by obstacles not by camera rotation.
How can I fix it?