Timeline wont call binded function with AddInterpFloat

Korred
Tue, 12 Mar 2024 21:56:40 +0000
C++

Hi
My timeline wont call binded function. Code looks like this

.h file

	FTimeline MovementTimeline;
	UCurveFloat* MovementCurve;

.cpp

constructor

	static ConstructorHelpers::FObjectFinder<UCurveFloat> CurveAssetFinder(TEXT("/Game/Map/Curve_mov"));

BeginPlay()

	FOnTimelineFloat timelineProgress;
	timelineProgress.BindUFunction(this, FName("ProcessMovementTimeline"));

	FOnTimelineEvent timelineEnded;
	timelineProgress.BindUFunction(this, FName("ProcessMovementEnd"));

	MovementTimeline.AddInterpFloat(MovementCurve, timelineProgress);
	MovementTimeline.SetTimelineFinishedFunc(timelineEnded);

	MovementTimeline.SetTimelineLengthMode(TL_LastKeyFrame);

Tick()

void ABaseUnit::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	if (pathUpdated)
	{
		MovementTimeline.Stop();
		UpdatePath();
		MovementTimeline.PlayFromStart();
	}

	if (MovementTimeline.IsPlaying())
	{
		UE_LOG(LogTemp, Log, TEXT("MovementTimeline.IsPlaying()"));
		MovementTimeline.TickTimeline(DeltaTime);
	}
}

binded function

void ABaseUnit::ProcessMovementTimeline(float Value)
{
	UE_LOG(LogTemp, Log, TEXT("ABaseUnit::ProcessMovementTimeline"));

	const float SplineLength = spline->GetSplineLength();

	const FVector CurrentSplineLocation = spline->GetLocationAtDistanceAlongSpline(Value * SplineLength, ESplineCoordinateSpace::World);
	FRotator CurrentSplineRotation = spline->GetRotationAtDistanceAlongSpline(Value * SplineLength, ESplineCoordinateSpace::World);

	CurrentSplineRotation.Pitch = 0.f;
	SkeletalMeshComponent->SetWorldLocationAndRotation(CurrentSplineLocation, CurrentSplineRotation);
}

There are simply no logs

UE_LOG(LogTemp, Log, TEXT("ABaseUnit::ProcessMovementTimeline"));

but these are shown

UE_LOG(LogTemp, Log, TEXT("MovementTimeline.IsPlaying()"));

so therefore function is not beeing called. Does anyone seems to know what is the problem?
BR

4 posts - 2 participants