Primitive
components are the most complex type of Actor
Component because they not only have a transform, but are also rendered on screen.
Create a custom C++ class based on
MeshComponent
. When Visual Studio loads, add the following to your class header file:UCLASS(ClassGroup=Experimental, meta = (BlueprintSpawnableComponent)) public: virtual FPrimitiveSceneProxy* CreateSceneProxy() override; TArray<int32> Indices; TArray<FVector> Vertices; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Materials) UMaterial* TheMaterial;
We need to create an implementation for our overridden
CreateSceneProxy
function in our cpp file:FPrimitiveSceneProxy* UMyMeshComponent::CreateSceneProxy() { FPrimitiveSceneProxy* Proxy = NULL; Proxy = new FMySceneProxy(this); return Proxy; }
This function returns an instance of
FMySceneProxy
, which we need to implement. Do so by adding the following code above theCreateSceneProxy
function:class...