资讯动态

UE5 C++ 绘制图形调试宏

发布时间:2026/8/10 6:53:46 来源:尧图企业网站定制
#pragmaonce#includeDrawDebugHelpers.h//绘制圆#defineDRAW_SHERE(Location)\if(GetWorld())DrawDebugSphere(GetWorld(),Location,100.f,12,FColor::Red,true);//绘制圆只显示一帧#defineDRAW_SHERE_SingleFrame(Location)\if(GetWorld())DrawDebugSphere(GetWorld(),Location,100.f,12,FColor::Red,false,-1.f);//绘制直线#defineDRAW_LINE(startLocation,endLocation)\if(GetWorld())DrawDebugLine(GetWorld(),startLocation,endLocation,FColor::Red,true,-1.f,0,1.f);//绘制直线,只显示一帧#defineDRAW_LINE(startLocation,endLocation)\if(GetWorld())DrawDebugLine(GetWorld(),startLocation,endLocation,FColor::Red,false,-1.f,0,1.f);//绘制点#defineDRAW_POINT(Location)\if(GetWorld())DrawDebugPoint(GetWorld(),Location,25.f,FColor::Red,true,-1.f,0);//绘制点,只显示一帧#defineDRAW_POINT(Location)\if(GetWorld())DrawDebugPoint(GetWorld(),Location,25.f,FColor::Red,false,-1.f,0);//绘制一个带点的直线点在直线末尾#defineDRAW_Vector(startLocation,endLocation)\if(GetWorld())\{\DrawDebugLine(GetWorld(),startLocation,endLocation,FColor::Red,true,-1.f,0,1.f);\DrawDebugPoint(GetWorld(),endLocation,15.f,FColor::Red,true,-1.f,0);\}//绘制一个带点的直线点在直线末尾,只显示一帧#defineDRAW_Vector(startLocation,endLocation)\if(GetWorld())\{\DrawDebugLine(GetWorld(),startLocation,endLocation,FColor::Red,false,-1.f,0,1.f);\DrawDebugPoint(GetWorld(),endLocation,15.f,FColor::Red,false,-1.f,0);\}\的作用是连接下一行字符串创建一个工具头文件储存这个宏注意地址要改到source文件夹里默认放在Intermediate里这个文件夹会在编译的时候被删除重建不要放在这里当创建后头文件的显示位置会和source文件夹同级这是因为VS的解决方案目录不是按照真实的文件结构显示的VS会自动把 source/项目名 下的文件显示到 Games/项目名 的级别如果文件被创建到source/项目名/public里则会显示在Publice文件夹下

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价