UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DebugDrawCommand.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
5#include "Containers/List.h"
6#include "Math/Vector.h"
7#include "Math/Color.h"
8#include "Math/Quat.h"
9
10class AActor;
11
12#if CHAOS_DEBUG_DRAW
13
14namespace Chaos
15{
17 {
18 FVector LineStart;
19 FVector LineEnd;
22 bool bPersistentLines;
23 float ArrowSize;
24 float LifeTime;
25 uint8 DepthPriority;
26 float Thickness;
27 FReal Radius;
28 FReal HalfHeight;
30 FVector Extent;
33 FString Text;
34 class AActor* TestBaseActor;
35 bool bDrawShadow;
36 float FontScale;
37 float Duration;
39 bool bDrawAxis;
40 FVector YAxis;
41 FVector ZAxis;
42
43 enum class EDrawType
44 {
45 Point,
46 Line,
48 Sphere,
49 Box,
50 String,
51 Circle,
52 Capsule,
53 } Type;
54
56 : TestBaseActor(nullptr)
57 {
58 }
59
60 static FLatentDrawCommand DrawPoint(const FVector& Position, const FColor& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority, float Thickness)
61 {
63 Command.LineStart = Position;
64 Command.Color = Color;
65 Command.bPersistentLines = bPersistentLines;
66 Command.LifeTime = LifeTime;
67 Command.DepthPriority = DepthPriority;
68 Command.Thickness = Thickness;
69 Command.Type = EDrawType::Point;
70 return Command;
71 }
72
73
74 static FLatentDrawCommand DrawLine(const FVector& LineStart, const FVector& LineEnd, const FColor& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority, float Thickness)
75 {
77 Command.LineStart = LineStart;
78 Command.LineEnd = LineEnd;
79 Command.Color = Color;
80 Command.bPersistentLines = bPersistentLines;
81 Command.LifeTime = LifeTime;
82 Command.DepthPriority = DepthPriority;
83 Command.Thickness = Thickness;
84 Command.Type = EDrawType::Line;
85 return Command;
86 }
87
88 static FLatentDrawCommand DrawDirectionalArrow(const FVector& LineStart, FVector const& LineEnd, float ArrowSize, const FColor& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority, float Thickness)
89 {
91 Command.LineStart = LineStart;
92 Command.LineEnd = LineEnd;
93 Command.ArrowSize = ArrowSize;
94 Command.Color = Color;
95 Command.bPersistentLines = bPersistentLines;
96 Command.LifeTime = LifeTime;
97 Command.DepthPriority = DepthPriority;
98 Command.Thickness = Thickness;
99 Command.Type = EDrawType::DirectionalArrow;
100 return Command;
101 }
102
103 static FLatentDrawCommand DrawDebugSphere(const FVector& Center, FVector::FReal Radius, int32 Segments, const FColor& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority, float Thickness)
104 {
106 Command.LineStart = Center;
107 Command.Radius = Radius;
108 Command.Color = Color;
109 Command.Segments = Segments;
110 Command.bPersistentLines = bPersistentLines;
111 Command.LifeTime = LifeTime;
112 Command.DepthPriority = DepthPriority;
113 Command.Thickness = Thickness;
114 Command.Type = EDrawType::Sphere;
115 return Command;
116 }
117
118 static FLatentDrawCommand DrawDebugBox(const FVector& Center, const FVector& Extent, const FQuat& Rotation, const FColor& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority, float Thickness)
119 {
121 Command.Center = Center;
122 Command.Extent = Extent;
123 Command.Rotation = Rotation;
124 Command.Color = Color;
125 Command.bPersistentLines = bPersistentLines;
126 Command.LifeTime = LifeTime;
127 Command.DepthPriority = DepthPriority;
128 Command.Thickness = Thickness;
129 Command.Type = EDrawType::Box;
130 return Command;
131 }
132
133 static FLatentDrawCommand DrawDebugString(const FVector& TextLocation, const FString& Text, class AActor* TestBaseActor, const FColor& Color, float Duration, bool bDrawShadow, float FontScale)
134 {
136 Command.TextLocation = TextLocation;
137 Command.Text = Text;
138 Command.TestBaseActor = TestBaseActor;
139 Command.Color = Color;
140 Command.Duration = Duration;
141 Command.LifeTime = Duration;
142 Command.bDrawShadow = bDrawShadow;
143 Command.FontScale = FontScale;
144 Command.Type = EDrawType::String;
145 return Command;
146 }
147
148 static FLatentDrawCommand DrawDebugCircle(const FVector& Center, FReal Radius, int32 Segments, const FColor& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority, float Thickness, const FVector& YAxis, const FVector& ZAxis, bool bDrawAxis)
149 {
151 Command.Center = Center;
152 Command.Radius = Radius;
153 Command.Segments = Segments;
154 Command.Color = Color;
155 Command.bPersistentLines = bPersistentLines;
156 Command.LifeTime = LifeTime;
157 Command.DepthPriority = DepthPriority;
158 Command.Thickness = Thickness;
159 Command.YAxis = YAxis;
160 Command.ZAxis = ZAxis;
161 Command.bDrawAxis = bDrawAxis;
162 Command.Type = EDrawType::Circle;
163 return Command;
164 }
165
166 static FLatentDrawCommand DrawDebugCapsule(const FVector& Center, FReal HalfHeight, FReal Radius, const FQuat& Rotation, const FColor& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority, float Thickness)
167 {
169 Command.Center = Center;
170 Command.HalfHeight = HalfHeight;
171 Command.Radius = Radius;
172 Command.Rotation = Rotation;
173 Command.Color = Color;
174 Command.bPersistentLines = bPersistentLines;
175 Command.LifeTime = LifeTime;
176 Command.DepthPriority = DepthPriority;
177 Command.Thickness = Thickness;
178 Command.Type = EDrawType::Capsule;
179 return Command;
180 }
181 };
182}
183
184#endif
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ENGINE_API void DrawDebugBox(const UWorld *InWorld, FVector const &Center, FVector const &Extent, FColor const &Color, bool bPersistentLines=false, float LifeTime=-1.f, uint8 DepthPriority=0, float Thickness=0.f)
ENGINE_API void DrawDebugCapsule(const UWorld *InWorld, FVector const &Center, float HalfHeight, float Radius, const FQuat &Rotation, FColor const &Color, bool bPersistentLines=false, float LifeTime=-1.f, uint8 DepthPriority=0, float Thickness=0)
ENGINE_API void DrawDebugCircle(const UWorld *InWorld, const FMatrix &TransformMatrix, double Radius, int32 Segments, const FColor &Color, bool bPersistentLines=false, float LifeTime=-1.f, uint8 DepthPriority=0, float Thickness=0.f, bool bDrawAxis=true)
ENGINE_API void DrawDebugString(const UWorld *InWorld, FVector const &TextLocation, const FString &Text, class AActor *TestBaseActor=NULL, FColor const &TextColor=FColor::White, float Duration=-1.000000, bool bDrawShadow=false, float FontScale=1.f)
ENGINE_API void DrawDebugSphere(const UWorld *InWorld, FVector const &Center, float Radius, int32 Segments, FColor const &Color, bool bPersistentLines=false, float LifeTime=-1.f, uint8 DepthPriority=0, float Thickness=0.f)
void DrawDirectionalArrow(FPrimitiveDrawInterface *PDI, const FMatrix &ArrowToWorld, const FLinearColor &InColor, float Length, float ArrowSize, uint8 DepthPriority, float Thickness)
Definition PrimitiveDrawingUtils.cpp:1437
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Actor.h:257
Definition SkeletalMeshComponent.h:307
@ DirectionalArrow
Definition AnimInstanceProxy.h:80
const Type Command
Definition GenericApplication.h:46
Type
Definition PawnAction_Move.h:11
Chaos::FReal FReal
Definition ImmediatePhysicsCore_Chaos.h:33
void DrawPoint(const TPoint &InPoint, EVisuProperty Property=EVisuProperty::BluePoint)
Definition Display.h:120
Definition Color.h:486
double FReal
Definition Vector.h:55