Unreal Engine 4 C + + drawing functions for debugging

Source: Internet
Author: User
Tags draw box in degrees

UE4 provides a lot of pre-defined debugging drawing functions, it is more convenient when doing debugging. You can draw points, lines, circles, balls, arrows, vertebrae, capsules, even splines, strings, meshes, and so on in the scene, all of which are basically there. The comparison is like, you can control the thickness of the line, debugging time is more intuitive.

To use these functions, you only need to include the DrawDebugHelpers.h header file. Here are a few of the main drawing functions:

1. Draw points
ENGINE_API void Drawdebugpoint (const uworld* inworld, Fvector const& Position, float Size, Fcolor const& Pointcolo R, BOOL Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);

In the optional parameters, we can control the size, color, duration and so on. Bpersistentlines indicates that the current drawing of the entire object, is not a persistent object, set to True, it will always show the current world until you call the following method to release it:
void Flushpersistentdebuglines (const uworld* inworld);
Other drawing functions, this parameter has the same meaning.
2. Draw lines
ENGINE_API void Drawdebugline (const uworld* inworld, Fvector const& linestart, Fvector const& LineEnd, FColor cons t& Color, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0, float Thickness = 0.f);

Note thickness This parameter, which controls the thickness of the line.
3. Draw Arrows
ENGINE_API void Drawdebugdirectionalarrow (const uworld* inworld, Fvector const& linestart, FVector const&  Lineend, float arrowsize, Fcolor const& Color, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);
This function draws a pointing arrow, similar to the drawing line, and Arrowsize is the size of the arrow.
4. Draw Box
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);/** Draw a debug box with rotation */e NGINE_API void Drawdebugbox (const uworld* inworld, Fvector const& Center, Fvector const& Box, const Fquat & Ro Tation, Fcolor const& Color, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);

The first one is drawn according to the box's size, and the second one can be drawn with a certain amount of rotation.
5. Draw a Sphere
ENGINE_API void Drawdebugsphere (const uworld* inworld, Fvector const& Center, float Radius, int32 segments, Fcolor con st& Color, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);
The segments controls the fragmentation of the sphere, the larger the finer the more.
6. There are many other less commonly used, can be drawn 2D circle, cylinder, vertebral body, flat head body, capsules and so on. It's only listed here, specifically.DrawDebugHelpers.h
ENGINE_API void Drawdebugcoordinatesystem (const uworld* inworld, Fvector const& axisloc, Frotator const& AxisRot , float scale, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);/** Draw Debug Circle */engine _API void drawdebugcircle (const uworld* inworld, const fmatrix& Transformmatrix, Float Radius, int32 segments, const F color& Color, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);/** Draw Debug 2D Donut */e NGINE_API void Drawdebug2ddonut (const uworld* inworld, const fmatrix& Transformmatrix, float Innerradius, float Outer  Radius, Int32 segments, const fcolor& Color, BOOL Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);/** Draw a debug sphere */engine_api void Drawdebugsphere (const uworld* inworld, Fvector const& Center, float Radi us, Int32 segments, Fcolor const& Color, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0); /** Draw a Debug cylinder */ENGINE_API void Drawdebugcylinder (const uworld* inworld, Fvector const& Start, Fvector const& End, float Radius, Int32 segments, Fcolor const& Color, bool Bpersistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0); ENGINE_API void Drawdebugcone (const uworld* inworld, Fvector const& Origin, Fvector const& Direction, float Length , float anglewidth, float angleheight, Int32 numsides, Fcolor const& Color, bool bpersistentlines=false, float Lifetim E=-1.F, Uint8 depthpriority = 0);/** used by gameplay when defining a cone by a vertical and horizontal dot products. */ENGINE_API void Drawdebugaltcone (const uworld* inworld, Fvector const& Origin, Frotator const& Rotation, float L Ength, float anglewidth, float angleheight, Fcolor const& drawcolor, bool bpersistentlines=false, float LIFETIME=-1.F , Uint8 depthpriority=0); ENGINE_API void drawdebugstring (const uworld* inworld, Fvector const& textlocation, const fstring& Text, Class AAc tor* TesTbaseactor = NULL, fcolor const& textcolor = fcolor::white, float Duration =-1.000000); ENGINE_API void Drawdebugfrustum (const uworld* inworld, const fmatrix& Frustumtoworld, Fcolor const& Color, BOOL B Persistentlines = False, float lifetime=-1.f, uint8 depthpriority = 0);/** Draw a capsule using the Linebatcher */engine_a PI void Drawdebugcapsule (const uworld* inworld, Fvector const& Center, float halfheight, float Radius, const fquat &AM P Rotation, Fcolor const& Color, bool bpersistentlines=false, float lifetime=-1.f, uint8 depthpriority = 0);/** Draw a D  Ebug camera shape. FOV is full angle in degrees.  */ENGINE_API void Drawdebugcamera (const uworld* inworld, Fvector const& location, Frotator const& Rotation, float Fovdeg, float scale=1.f, Fcolor const& color=fcolor::white, bool bpersistentlines=false, float lifetime=-1.f, uint8 D epthpriority = 0); ENGINE_API void flushdebugstrings (const uworld* inworld); ENGINE_API void Drawdebugsolidbox (const uworld* INworld, Fvector const& Center, Fvector const& Box, Fcolor const& Color, bool bpersistent=false, float LifeTime =-1.F, Uint8 depthpriority = 0); ENGINE_API void Drawdebugsolidbox (const uworld* inworld, Fvector const& Center, Fvector const& Extent, FQuat const & Rotation, Fcolor const& Color, bool bpersistent=false, float lifetime=-1.f, uint8 depthpriority = 0); ENGINE_API void Drawdebugmesh (const uworld* Inworld, tarray<fvector> const& verts, tarray<int32> const& Amp Indices, Fcolor const& Color, bool bpersistent=false, float lifetime=-1.f, uint8 depthpriority = 0);  ENGINE_API void Drawdebugsolidplane (const uworld* inworld, Fplane const& P, Fvector const& Loc, float Size, FColor const& Color, bool bpersistent=false, float lifetime=-1, uint8 depthpriority = 0);/* Draws a 2D histogram of size ' Dr Awsize ' based fdebugfloathistory struct, using drawtransform for the position of the world. */engine_api void Drawdebugfloathistory (Uworld CoNST & Worldref, fdebugfloathistory const & floathistory, Ftransform const & DrawTransform, fvector2d const &AM P Drawsize, Fcolor const & Drawcolor, bool const & bpersistent = False, float const & LifeTime = -1.f, uint8 con  St & depthpriority = 0);/* Draws a 2D histogram of size ' drawsize ' based fdebugfloathistory struct, using drawlocation For the location in the world, rotation would face camera of first player. */engine_api void Drawdebugfloathistory (Uworld const & WORLDREF, Fdebugfloathistory const & Floathistory, Fvector Const & Drawlocation, fvector2d const & drawsize, Fcolor const & Drawcolor, BOOL const & Bpersiste NT = False, float const & LifeTime = -1.F, uint8 const & depthpriority = 0);




Unreal Engine 4 C + + drawing functions for debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.