I’m trying to go with some of the helper classes on the runtime mesh but everything seems to fail. Can anyone help out?
Until now I was using
void CreateMeshSection(int32 SectionIndex, const TArray<FVector>& Vertices, const TArray<int32>& Triangles, const TArray<FVector>& Normals,
const TArray<FVector2D>& UV0, const TArray<FColor>& Colors, const TArray<FRuntimeMeshTangent>& Tangents, bool bCreateCollision = false,
EUpdateFrequency UpdateFrequency = EUpdateFrequency::Average, ESectionUpdateFlags UpdateFlags = ESectionUpdateFlags::None);
to create my meshes. But the helper classes are there for some reason, make it abit easier, keep stuff where it belongs. Thought to give it a try.
Trying to use
void CreateMeshSection(int32 SectionIndex, IRuntimeMeshVerticesBuilder& Vertices, FRuntimeMeshIndicesBuilder& Indices, bool bCreateCollision = false,
EUpdateFrequency UpdateFrequency = EUpdateFrequency::Average, ESectionUpdateFlags UpdateFlags = ESectionUpdateFlags::None);
for the ‘IRuntimeMeshVerticesBuilder’ I’m trying to use ‘FRuntimeMeshComponentVerticesBuilder’.
#pragma once
#include "GameFramework/Actor.h"
#include "RuntimeMeshComponent.h"
#include "Vase.generated.h"
UCLASS()
class VASEGENERATOR_API AVase : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AVase();
~AVase();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
private:
UPROPERTY()
URuntimeMeshComponent* vaseRuntimeMesh;
FRuntimeMeshComponentVerticesBuilder verticesBuilder; // fails cause there is no default contructor
FRuntimeMeshIndicesBuilder triangles;
// The outline of the vase when looking from the side
TArray<FVector> outlineVertical;
// The outline of the vase when looking down from the top
TArray<FVector> outlineHorizontal;
};
So trying to construct that ‘verticesBuilder’
//The constructor im trying to use
//FRuntimeMeshComponentVerticesBuilder(bool bInWantsNormal, bool bInWantsTangent, bool bInWantsColor, bool bInWantsUV0, bool bInWantsUV1)
FRuntimeMeshComponentVerticesBuilder verticesBuilder(true, false, false, false, false) //fails with: error C2059: syntax error: 'constant'
another try
Vase() : verticesBuilder(true, false, false, false, false) {}
FRuntimeMeshComponentVerticesBuilder verticesBuilder; //fails telling me there is no default constructor
well, trying pointer
Vase()
{
}
FRuntimeMeshComponentVerticesBuilder* verticesBuilder;
Compiles fine. Able to open the project.
Vase()
{
verticesBuilder = new FRuntimeMeshComponentVerticesBuilder(true, false, false, false, false);
}
FRuntimeMeshComponentVerticesBuilder* verticesBuilder;
this compiles, but crashes the project… “The game module could not be loaded. There may be an operating system error or the module may not be properly setup”.
returning back to
Vase()
{
}
FRuntimeMeshComponentVerticesBuilder* verticesBuilder;
I again can compile and open the project. What am I doing wrong?
verticesBuilder = new FRuntimeMeshComponentVerticesBuilder(true, false, false, false, false); // whats the issue?
‘FRuntimeMeshComponentVerticesBuilder’ is not of UClass type.