RealDocs

UKismetSystemLibrary::DrawDebugFrustum

function Engine Blueprint Since 4.0
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Draws a wireframe view frustum from a transform, useful for visualizing a camera's or light's projection volume.

Caveats & Gotchas

  • FrustumTransform must encode the unit frustum-to-world transform (as built from an inverse view-projection matrix), not a simple actor transform — passing an actor's transform directly produces a degenerate or unit-cube frustum.
  • Compiled out entirely in Shipping and Test builds since the UFUNCTION is DevelopmentOnly.

Signature

static void DrawDebugFrustum(const UObject* WorldContextObject, const FTransform& FrustumTransform, FLinearColor FrustumColor = FLinearColor::White, float Duration=0.f, float Thickness = 0.f)

Parameters

Name Type Description Default
WorldContextObject const UObject* World context used to resolve which world to draw in.
FrustumTransform const FTransform& Transform describing the frustum, typically a camera's inverse view-projection matrix expressed as a transform.
FrustumColor FLinearColor Color of the drawn frustum. FLinearColor::White
Duration float How long the frustum persists, in seconds. 0 draws for a single frame. 0.f
Thickness float Line thickness in screen pixels. 0.f

Return Type

void

Example

Visualize a camera's projection volume C++
FMatrix ViewMatrix, ProjectionMatrix, ViewProjectionMatrix;
UGameplayStatics::GetPlayerController(this, 0)->GetPlayerViewPoint(CamLocation, CamRotation);
// Build ViewProjectionMatrix via FSceneView helpers, then:
UKismetSystemLibrary::DrawDebugFrustum(
    this,
    FTransform(ViewProjectionMatrix.InverseFast()),
    FLinearColor::Green,
    1.0f);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.