TArray<FVector2i> Edges;
Edges.SetNum(Triangles.Num());
for (int i = 0; i < Triangles.Num(); i += 3)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 2; k++)
{
int Index = (j + k) % 3;
if (k == 0)
Edges[i + j].X = Triangles[i + Index];
else if (k == 1)
Edges[i + j].Y = Triangles[i + Index];
}
}
这篇文章很形象的比喻了二者的目的和一些实用的用途: B乎链接
DrawDebugLine(GFalconVGameMode->GetWorld(), StartPoint, EndPoint, FColor::MakeRandomColor(), true);
FPaths::ProjectConfigDir()
FString::FromInt(AutoNum)
FString JsonString;
TSharedPtr<FJsonObject> TargetJsonObj = MakeShareable(new FJsonObject());
TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(JsonString);
if (FJsonSerializer::Deserialize(JsonReader , TargetJsonObj ))//为了防止构造失败,加一个if判断一下再继续
{
return TargetJsonObj;//jsonobject就构造出来了
}
FString ReturnJson;
TSharedPtr<FJsonObject> JsonObj = MakeShared<FJsonObject>();
TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&ReturnJson);
if(FJsonSerializer::Serialize(JsonObj.ToSharedRef(), Writer))
{
return ReturnJson;
};
参照官方这个文档VS使用技巧中的-枚举转换为字符串
获取Location
FTransform OriginTransform;
OriginTransform.GetTranslation();
获取Rotation(欧拉角)
FTransform OriginTransform;
OriginTransform.GetRotation().Rotator();
获取Rotation(四元数)
FTransform OriginTransform;
OriginTransform.GetRotation();
UHierarchicalInstancedStaticMeshComponent* HISM = NewObject<UHierarchicalInstancedStaticMeshComponent>(this);
HISM->AttachToComponent(SceneComponent, FAttachmentTransformRules::KeepRelativeTransform);
HISM->SetStaticMesh(CurrentPlantMesh);
HISM->RegisterComponent();
UHierarchicalInstancedStaticMeshComponent* HISM = CreateDefaultSubobject<UHierarchicalInstancedStaticMeshComponent>(TEXT("youname"));
HISM ->SetupAttachment(RootComponent);
FRemoveNativeInstanceDataCommand::FRemoveNativeInstanceDataCommand(const TArray<FString>& InDataIDArray)
: InstanceDataIDArray(InDataIDArray)//构造函数的初始化列表
{
}
FRemoveNativeInstanceDataCommand::FRemoveNativeInstanceDataCommand(const TArray<FString>& InDataIDArray)
{
InstanceDataIDArray=InDataIDArray;
}
参照这个文档——C++中指针和引用的区别
参照这个博客——加载资源方式
参照官方这个文档VS使用技巧
枚举转换为字符串
USTRUCT(noexport)
struct FFloatInterval
{
/** Values must be >= Min */
UPROPERTY(EditAnywhere, Category=Interval)
float Min;
/** Values must be <= Max */
UPROPERTY(EditAnywhere, Category=Interval)
float Max;
};
class UHierarchicalInstancedStaticMeshComponent* YourComponentName;
class TArray<UHierarchicalInstancedStaticMeshComponent*> YourComponentsName;