Files
UnrealEngineUWP/Engine/Source/Editor/ComponentVisualizers/Private/SensingComponentVisualizer.cpp
sebastian kowalczyk b5d27560b2 Extended functions for debug drawing (API from SceneManagement.h file):
- Added "Thickness" parameter to some functions (only for wired shapes rendering and with 0 as default value)
- Added GetHalfSphereMesh, GetConeMesh and GetCapsuleMesh functions

#codereview Daniel.Wright

[CL 2363368 by sebastian kowalczyk in Main branch]
2014-11-18 10:15:20 -05:00

38 lines
1.1 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "ComponentVisualizersPrivatePCH.h"
#include "SensingComponentVisualizer.h"
#include "Perception/PawnSensingComponent.h"
void FSensingComponentVisualizer::DrawVisualization(const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI)
{
if (View->Family->EngineShowFlags.VisualizeSenses)
{
const UPawnSensingComponent* Senses = Cast<const UPawnSensingComponent>(Component);
if (Senses != NULL)
{
const FTransform Transform = FTransform(Senses->GetSensorRotation(), Senses->GetSensorLocation());
//LOS hearing
if (Senses->LOSHearingThreshold > 0.0f)
{
DrawWireSphere(PDI, Transform, FColor::Yellow, Senses->LOSHearingThreshold, 16, SDPG_World);
}
//Hearing
if (Senses->HearingThreshold > 0.0f)
{
DrawWireSphere(PDI, Transform, FColor::Cyan, Senses->HearingThreshold, 16, SDPG_World);
}
// Sight
if (Senses->SightRadius > 0.0f)
{
TArray<FVector> Verts;
DrawWireCone(PDI, Verts, Transform, Senses->SightRadius, Senses->GetPeripheralVisionAngle(), 10, FColor::Green, SDPG_World);
}
}
}
}