网站适合移动端,制作简历网站开发,做网站就上凡科建站,邯郸网站设计怎么开发多人射击有点难#xff0c;发现这个更加基础#xff0c;先学习这个
显示日志
可以在代码中插入这样一行来打印日志#xff0c;蓝图里的printstring会在屏幕和日志里都显示。可以使用%f#xff0c;d等来获取后边的输入值。对于打映字符串变量#xff0c;传入需要* UE_LOG…多人射击有点难发现这个更加基础先学习这个
显示日志
可以在代码中插入这样一行来打印日志蓝图里的printstring会在屏幕和日志里都显示。可以使用%fd等来获取后边的输入值。对于打映字符串变量传入需要* UE_LOG(LogTemp,Warning,TEXT(time:%f), DeltaTime);
if (GEngine)
{ FString Name GetName();FString Message FString::Printf(TEXT(name:%s), *Name);//显示位置时间颜色文本GEngine-AddOnScreenDebugMessage(-1, 5, FColor::Red,Message);
}Draw a debug sphere
可以将画球的代码封装成宏放到一个新的头文件里那么在别的代码里也能直接调用同时引入头文件 Draw a debug Line
if (World)
{ //获取向前的单位向量FVector Forward GetActorForwardVector();//地图起始点终止点颜色时间DrawDebugLine(World,Location,LocationForward*100.f,FColor::Red,false,60.f);
} Draw a debug point
if (World)
{DrawDebugPoint(World, Location Forward * 100.f,15.f,FColor::Blue,true);
} 将它们都定义成宏来调用
#define DRAW_SPHERE(Location) if(GetWorld()) DrawDebugSphere(GetWorld(), Location,25.f,24,FColor::Red,false,30.f);
#define DRAW_LINE(StartLocation,EndLocation) if(GetWorld()) DrawDebugLine(GetWorld(),StartLocation,EndLocation,FColor::Red,true,-1.f,0,1.f);
#define DRAW_POINT(Location) if(GetWorld()) DrawDebugPoint(GetWorld(),Location,15.f,FColor::Blue,true);
#define DRAW_VECTOR(StartLocation,EndLocation) if(GetWorld())\{\DrawDebugLine(GetWorld(),StartLocation,EndLocation,FColor::Red,true,-1.f,0,1.f);\DrawDebugPoint(GetWorld(), EndLocation, 15.f, FColor::Blue, true);}void Aitem::BeginPlay()
{Super::BeginPlay();UE_LOG(LogTemp,Warning,TEXT(BeginPLay));if (GEngine){//显示位置时间颜色文本GEngine-AddOnScreenDebugMessage(-1,5,FColor::Red,TEXT(hello));}//得到所在世界UWorld* World GetWorld();//获取组件的位置FVector Location GetActorLocation();//获取向前的单位向量FVector Forward GetActorForwardVector();DRAW_SPHERE(Location);/*DRAW_LINE(Location,LocationForward*100.f);DRAW_POINT(Location Forward * 100.f);*/DRAW_VECTOR(Location, Location Forward * 100.f);
}