Are SplineMeshComponents Working Yet?

Dear Friends at Epic,

I’m super excited to see that you are supporting collision for spline meshes in UE4!

Yay!

Are they working yet?

I tried to add a spline mesh component to my custom StaticMesh Actor class, and set its parameters in the constructor without any success so far, I cannot get the spline mesh to deform

UCLASS(placeable, dependson=UVictoryCore)
class AVictoryWall : public AJoySMA
{
	GENERATED_UCLASS_BODY()
		
	/*
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spline)
	FVector StartPos;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spline)
	FVector StartTangent;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spline)
	FVector2D StartScale;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spline)
	FVector EndPos;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spline)
	FVector EndTangent;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spline)
	FVector2D EndScale;
	
	UPROPERTY(Category=VictoryWall, VisibleAnywhere, BlueprintReadOnly, meta=(ExposeFunctionCategories="Mesh,Rendering,Physics"))
	TSubobjectPtr SplineMeshComponent;
	
	
public:
	
	//TSubobjectPtr SplineMeshComponent;
	FSplineMeshParams InitialSplineParams;
	UStaticMesh * SplineMesh;

.cpp

//Spline Mesh
	static ConstructorHelpers::FObjectFinder SplineMeshOb(TEXT("StaticMesh'/Game/WorldElements/Shapes/CurvedBox.CurvedBox'"));
	SplineMesh = SplineMeshOb.Object;
	
	//Was Asset Found?
	if (SplineMesh != NULL)
	{
		//create new object
		SplineMeshComponent = PCIP.CreateDefaultSubobject < USplineMeshComponent > (this, TEXT("SplineMeshComponentMesh"));
		Components.Add(SplineMeshComponent);

		SplineMeshComponent->SetStaticMesh(SplineMesh);
	
		SplineMeshComponent->bOwnerNoSee = false;
		SplineMeshComponent->bCastDynamicShadow = true;
		SplineMeshComponent->CastShadow = true;
		SplineMeshComponent->BodyInstance.SetMovementChannel(ECC_Dynamic);
		SplineMeshComponent->BodyInstance.SetCollisionEnabled(ECollisionEnabled::NoCollision);
		
		//Set Parameters
		InitialSplineParams.StartPos 		=StartPos;
		InitialSplineParams.StartTangent	=StartTangent;
		InitialSplineParams.StartScale		=StartScale;
		InitialSplineParams.EndPos			=EndPos;
		InitialSplineParams.EndTangent		=EndTangent;
		InitialSplineParams.EndScale			=EndScale;
	
		SplineMeshComponent->SplineParams = InitialSplineParams;
		
		//SplineMeshComponent->RecreateCollision();
	}

The settings I tried were:

Start pos 0,0,0
start scale 1,1

end pos 0 0 512
end scale 1,1

everything else zero’ed


#RecreateCollision

I noticed that RecreateColllision() only worked WITH_EDITOR

is there a reason we cant call this from c++ during game time in a shipping build?

#if WITH_EDITOR
	// Builds collision for the spline mesh (if collision is enabled)
	void RecreateCollision();
#endif

Rama

Hi Rama,

Currently splines are only being supported with Landscape. It is a higher priority on our “To Do” list and there are plans for implementing splines more in the editor. The way that you have created splines is pretty impressive, but not a recommended workflow. Could you post your second question in a different post? It would make looking up the answers a lot easier for other users.

Thank you,

Alexander