Unreal engine 4 C++ 一些调试用的绘制函数

本文介绍了Unreal Engine 4中用于调试的C++绘制函数,包括绘制点、线、箭头、Box和球体等,通过包含DrawDebugHelpers.h头文件即可使用,有助于提升调试的直观性。
摘要由CSDN通过智能技术生成

UE4中提供了很多预定义的调试绘制函数,在做调试的时候还是比较方便的。可以在场景里绘制点、线、圆、球、箭头、椎体、胶囊、甚至样条线、字符串、网格等等,基本上该有的都有了。比较赞的是,你能控制线条的厚度,调试的时候就比较直观了。

要使用这些函数,只需要包含DrawDebugHelpers.h 头文件即可。下面介绍几个主要的绘制函数:

1.绘制点

ENGINE_API void DrawDebugPoint(const UWorld* InWorld, FVector const& Position, float Size, FColor const& PointColor, bool bPersistentLines = false, float LifeTime=-1.f, uint8 DepthPriority = 0);

可选参数里面,我们可以控制点的尺寸、颜色、持续时间等。bPersistentLines表示,当前绘制的整个对象,是不是持久对象,设为true,它会一直显示当前World,直到你调用下面这个方法,释放它:
 void FlushPersistentDebugLines(const UWorld* InWorld);
其他的绘制函数,此参数意义都是一样的。

2.绘制线

ENGINE_API void DrawDebugLine(const UWorld* InWorld, FVector const& LineStart, FVector const& LineEnd, FColor const& Color, bool bPersistentLines = false, float LifeTime=-1.f, uint8 DepthPriority = 0, float Thickness = 0.f);

注意Thickness这个参数,它控制线条的厚度。

3.绘制箭头

ENGINE_API void DrawDebugDirectionalArrow(const UWorld* InWorld, FVector const& LineStart, FVector const& LineEnd, float ArrowSize, FColor const& Color, bool bPersist
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Unreal Engine 4 Scripting with C++ Cookbook 2016 | ISBN-10: 1785885545 | 431 pages | PDF | 7 MB Key Features A straightforward and easy-to-follow format A selection of the most important tasks and problems Carefully organized instructions to solve problems efficiently Clear explanations of what you did Solutions that can be applied to solve real-world problems Book Description Unreal Engine 4 (UE4) is a complete suite of game development tools made by game developers, for game developers. With more than 100 practical recipes, this book is a guide showcasing techniques to use the power of C++ scripting while developing games with UE4. It will start with adding and editing C++ classes from within the Unreal Editor. It will delve into one of Unreal's primary strengths, the ability for designers to customize programmer-developed actors and components. It will help you understand the benefits of when and how to use C++ as the scripting tool. With a blend of task-oriented recipes, this book will provide actionable information about scripting games with UE4, and manipulating the game and the development environment using C++. Towards the end of the book, you will be empowered to become a top-notch developer with Unreal Engine 4 using C++ as the scripting language. What you will learn Build function libraries (Blueprints) containing reusable code to reduce upkeep Move low-level functions from Blueprint into C++ to improve performance Abstract away complex implementation details to simplify designer workflows Incorporate existing libraries into your game to add extra functionality such as hardware integration Implement AI tasks and behaviors in Blueprints and C++ Generate data to control the appearance and content of UI elements
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值