Exemple #1
0
void UAISenseConfig_Hearing::DrawDebugInfo(UCanvas& Canvas, UAIPerceptionComponent& PerceptionComponent) const
{
    const AActor* BodyActor = PerceptionComponent.GetBodyActor();
    if (BodyActor != nullptr)
    {
        UWorld* World = BodyActor->GetWorld();
        FVector OwnerLocation = BodyActor->GetActorLocation();
        DrawDebugCylinder(World, OwnerLocation, OwnerLocation + FVector(0, 0, -50), HearingRange, 32, UAISense_Hearing::GetDebugHearingRangeColor());
        if (bUseLoSHearing)
        {
            DrawDebugCylinder(World, OwnerLocation, OwnerLocation + FVector(0, 0, -50), LoSHearingRange, 32, UAISense_Hearing::GetDebugLoSHearingRangeeColor());
        }
    }
}
Exemple #2
0
void UAISenseConfig_Sight::DrawDebugInfo(UCanvas& Canvas, UAIPerceptionComponent& PerceptionComponent) const
{
    /*PeripheralVisionAngleDegrees*/
    const AActor* BodyActor = PerceptionComponent.GetBodyActor();
    if (BodyActor != nullptr)
    {
        UWorld* World = BodyActor->GetWorld();
        FVector BodyLocation, BodyFacing;
        PerceptionComponent.GetLocationAndDirection(BodyLocation, BodyFacing);
        DrawDebugCylinder(World, BodyLocation, BodyLocation + FVector(0, 0, -50), SightRadius, 32, UAISense_Sight::GetDebugSightRangeColor());
        DrawDebugCylinder(World, BodyLocation, BodyLocation + FVector(0, 0, -50), LoseSightRadius, 32, UAISense_Sight::GetDebugLoseSightColor());

        const float SightPieLength = FMath::Max(LoseSightRadius, SightRadius);
        DrawDebugLine(World, BodyLocation, BodyLocation + (BodyFacing * SightPieLength), UAISense_Sight::GetDebugSightRangeColor());
        DrawDebugLine(World, BodyLocation, BodyLocation + (BodyFacing.RotateAngleAxis(PeripheralVisionAngleDegrees, FVector::UpVector) * SightPieLength), UAISense_Sight::GetDebugSightRangeColor());
        DrawDebugLine(World, BodyLocation, BodyLocation + (BodyFacing.RotateAngleAxis(-PeripheralVisionAngleDegrees, FVector::UpVector) * SightPieLength), UAISense_Sight::GetDebugSightRangeColor());
    }
}