26 if (ViewPoint.IsZero())
28 FRotator ViewRotation;
29 GetActorEyesViewPoint(ViewPoint, ViewRotation);
32 if (ViewPoint.IsZero())
38 static FName NAME_LineOfSight =
FName(TEXT(
"LineOfSight"));
39 FVector TargetLocation =
Other->GetTargetLocation(GetPawn());
41 FCollisionQueryParams CollisionParams(NAME_LineOfSight,
true, this->GetPawn());
42 CollisionParams.AddIgnoredActor(
Other);
44 bool bHit = GetWorld()->LineTraceTestByChannel(ViewPoint, TargetLocation, ECC_Visibility, CollisionParams);
52 const APawn * OtherPawn = Cast<const APawn>(
Other);
53 if (!OtherPawn && Cast<UCapsuleComponent>(
Other->GetRootComponent()) == NULL)
62 const float DistSq = (OtherActorLocation - ViewPoint).SizeSquared();
63 if (DistSq > FARSIGHTTHRESHOLDSQUARED)
68 if (!OtherPawn && (DistSq > NEARSIGHTTHRESHOLDSQUARED))
73 float OtherRadius, OtherHeight;
74 Other->GetSimpleCollisionCylinder(OtherRadius, OtherHeight);
76 if (!bAlternateChecks || !bLOSflag)
79 bHit = GetWorld()->LineTraceTestByChannel(ViewPoint, OtherActorLocation + FVector(0.f, 0.f, OtherHeight), ECC_Visibility, CollisionParams);
86 if (!bSkipExtraLOSChecks && (!bAlternateChecks || bLOSflag))
89 if (OtherRadius * OtherRadius / (OtherActorLocation - ViewPoint).SizeSquared() < 0.0001f)
95 Points[0] = OtherActorLocation - FVector(OtherRadius, -1 * OtherRadius, 0);
96 Points[1] = OtherActorLocation + FVector(OtherRadius, OtherRadius, 0);
97 Points[2] = OtherActorLocation - FVector(OtherRadius, OtherRadius, 0);
98 Points[3] = OtherActorLocation + FVector(OtherRadius, -1 * OtherRadius, 0);
101 float CurrentMax = (Points[0] - ViewPoint).SizeSquared();
102 float CurrentMin = CurrentMax;
103 for (int32 PointIndex = 1; PointIndex < 4; PointIndex++)
105 const float NextSize = (Points[PointIndex] - ViewPoint).SizeSquared();
106 if (NextSize > CurrentMin)
108 CurrentMin = NextSize;
109 IndexMax = PointIndex;
111 else if (NextSize < CurrentMax)
113 CurrentMax = NextSize;
114 IndexMin = PointIndex;
118 for (int32 PointIndex = 0; PointIndex < 4; PointIndex++)
120 if ((PointIndex != IndexMin) && (PointIndex != IndexMax))
122 bHit = GetWorld()->LineTraceTestByChannel(ViewPoint, Points[PointIndex], ECC_Visibility, CollisionParams);